Manual:Hooks/SpecialSearchResultsPrepend

From MediaWiki.org
Jump to navigation Jump to search
SpecialSearchResultsPrepend
Available from version 1.21.0
'SpecialSearchResultsPrepend': Called immediately before returning HTML on the search results page. Useful for including an external search provider. To disable the output of MediaWiki search output, return false.
Define function:
public static function onSpecialSearchResultsPrepend( $specialSearch, $output, $term ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SpecialSearchResultsPrepend": "MyExtensionHooks::onSpecialSearchResultsPrepend"
	}
}

For MediaWiki ≤1.25:

$wgHooks['SpecialSearchResultsPrepend'][] = 'MyExtensionHooks::onSpecialSearchResultsPrepend';
Called from:File(s): SpecialSearch.php

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

Details[edit]

  • $specialSearch: SpecialSearch object ($this)
  • $output: OutputPage object
  • $term: Search term specified by the user

See also[edit]