Manual:Hooks/SpecialSearchPowerBox

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.
SpecialSearchPowerBox
<translate> Available from <tvar name=1><translate> version <tvar (r97175, codereview)</tvar></translate>
The equivalent of SpecialSearchProfileForm for the advanced form, a.k.a. power search box
<translate> Define function:</translate>
public static function onSpecialSearchPowerBox( &$showSections, $term, $opts ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"SpecialSearchPowerBox": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialSearchPowerBox"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> specials/SpecialSearch.php
<translate> Interface:</translate> SpecialSearchPowerBoxHook.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:SpecialSearchPowerBox extensions</tvar>.</translate>


Details

The equivalent of SpecialSearchProfileForm 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