Manual:Hooks/SpecialSearchPowerBox

From MediaWiki.org
Jump to navigation Jump to search
SpecialSearchPowerBox
Available from version 1.18.0 (r97175)
The equivalent of SpecialSearchProfileForm for the advanced form, a.k.a. power search box
Define function:
public static function onSpecialSearchPowerBox( &$showSections, $term, $opts ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SpecialSearchPowerBox": "MyExtensionHooks::onSpecialSearchPowerBox"
	}
}

For MediaWiki ≤1.25:

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

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

Details[edit]

The equivalent of SpecialSearchProfileFormTemplate:Enlink/list1 for the advanced form, a.k.a. power search box.

  • The first parameter, $showSections, is an array of the following keys containing input forms:
    • 'namespaceTables'
    • 'redirects' (if supported by the search engine)
  • $term is the search term
  • $opts is an array of hidden options with keys 'redirs' and 'profile', of which only 'profile' is added as hidden input. Starting from MediaWiki 1.32, $opts passed by reference. This mean allowing extensions to modify or even unset it.

See also[edit]