Manual:Hooks/SearchResultProvideDescription

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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