Open main menu

Manual:Hooks/SpecialSearchCreateLink

SpecialSearchCreateLink
Available from version 1.18.0 (r97175)
Called when making the message to create a page or go to the existing page.
Define function:
public static function onSpecialSearchCreateLink( $t, &$params ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SpecialSearchCreateLink": "MyExtensionHooks::onSpecialSearchCreateLink"
	}
}

For MediaWiki ≤1.25:

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

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

DetailsEdit

Called on Special:Search when making the message to create a page or go to the existing page.

  • $t is the Title object of the search term
  • $params is an array containing
    • the message name, by default one of 'searchmenu-exists', 'searchmenu-new', 'searchmenu-new-nocreate'
    • the search term as escaped parameter $1
    • the number of search results found as parameter $2 [added in gerrit change 99265]

Parameters for the message can be added by adding values to the $params array.

No message will be displayed if the message name is false or null.

See alsoEdit