Manual:Hooks/SearchResultProvideDescription
From Linux Web Expert
File:OOjs UI icon notice-warning.svg | This hook is under development and currently should be considered unstable. |
SearchResultProvideDescription | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 588999)</tvar></translate> Called when generating search results in order to fill the "description" field in an extension. | |
<translate> Define function:</translate> | public static function onSearchResultProvideDescription( array $pageIdentities, array &$descriptions ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"SearchResultProvideDescription": "MediaWiki\\Extension\\MyExtension\\Hooks::onSearchResultProvideDescription"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> Rest/Handler/SearchHandler.php <translate> Function(s):</translate> buildDescriptionsFromPageIdentities |
<translate> Interface:</translate> | SearchResultProvideDescriptionHook.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:SearchResultProvideDescription extensions</tvar>.</translate>
Details
- $pageIdentities: an array (
string => MediaWiki\Rest\Entity\SearchResultPageIdentity
) where the key is pageId. - &$descriptions: an output array (string=>string|null) where the key is pageId and value is either a desciption for given page or null