Manual:Hooks/ApiOpenSearchSuggest
ApiOpenSearchSuggest | |
---|---|
Available from version 1.25.0 Called when constructing the OpenSearch results. Hooks can alter or append to the array. | |
Define function: | public static function onApiOpenSearchSuggest( &$results ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"ApiOpenSearchSuggest": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiOpenSearchSuggest"
}
}
|
Called from: | File(s): api/ApiOpenSearch.php |
Interface: | ApiOpenSearchSuggestHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ApiOpenSearchSuggest extensions.
Details
edit&$results
: array with integer keys to associative arrays. Keys in associative:title
: Title object.redirect from
: Title or null.extract
: Description for this result.extract trimmed
: If truthy, the extract will not be trimmed to$wgOpenSearchDescriptionLength.
image
: Thumbnail for this result. Value is an array with subkeys 'source
' (url), 'width
', 'height
', 'alt
', 'align
'.url
: Url for the given title.