Manual:Hooks/SearchResultProvideThumbnail

SearchResultProvideThumbnail
Available from version 1.35.0 (Gerrit change 588999)
This hook is called when generating search results in order to fill the thumbnail field in an extension.
Define function:
public static function onSearchResultProvideThumbnail( array $pageIdentities, array &$thumbnails ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SearchResultProvideThumbnail": "MyExtensionHooks::onSearchResultProvideThumbnail"
	}
}
Called from:File(s): Rest/Handler/SearchHandler.php
Function(s): buildThumbnailsFromPageIdentities
Interface:SearchResultProvideThumbnailHook.php

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

ParametersEdit

  • $pageIdentities: An array (map of strings to MediaWiki\Rest\Entity\SearchResultPageIdentity) where key is pageId.
  • &$thumbnails: An output array ( map of strings to MediaWiki\Search\Entity\SearchResultThumbnail) where key is pageId and value is either a valid MediaWiki\Search\Entity\SearchResultThumbnail for given page or null