Manual:Hooks/SpecialSearchResultsPrepend

From Linux Web Expert

Revision as of 22:59, 21 December 2023 by imported>Pppery (→‎See also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

SpecialSearchResultsPrepend
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
'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.
<translate> Define function:</translate>
public static function onSpecialSearchResultsPrepend( $specialSearch, $output, $term ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"SpecialSearchResultsPrepend": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialSearchResultsPrepend"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> specials/SpecialSearch.php
<translate> Interface:</translate> SpecialSearchResultsPrependHook.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:SpecialSearchResultsPrepend extensions</tvar>.</translate>


Details

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

See also