Manual:Hooks/ApiOpenSearchSuggest
From Linux Web Expert
ApiOpenSearchSuggest | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> Called when constructing the OpenSearch results. Hooks can alter or append to the array. | |
<translate> Define function:</translate> | public static function onApiOpenSearchSuggest( &$results ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"ApiOpenSearchSuggest": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiOpenSearchSuggest"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> api/ApiOpenSearch.php |
<translate> Interface:</translate> | ApiOpenSearchSuggestHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ApiOpenSearchSuggest extensions</tvar>.</translate>
Details
&$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.