Manual:Hooks/SearchResultProvideDescription

SearchResultProvideDescription
Available from version 1.35.0 (Gerrit change 588999)
Called when generating search results in order to fill the "description" field in an extension.
Define function:
public static function onSearchResultProvideDescription( array $pageIdentities, array &$descriptions ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"SearchResultProvideDescription": "MediaWiki\\Extension\\MyExtension\\Hooks::onSearchResultProvideDescription"
	}
}
Called from: File(s): Rest/Handler/SearchHandler.php
Function(s): buildDescriptionsFromPageIdentities
Interface: SearchResultProvideDescriptionHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:SearchResultProvideDescription extensions.


Details

edit
  • $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