Jump to content

Manual:Hooks/SpecialSearchCreateLink

From mediawiki.org
SpecialSearchCreateLink
Available from version 1.18.0 (r97175, codereview)
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialSearchCreateLink"
	}
}
Called from: File(s): specials/SpecialSearch.php
Interface: SpecialSearchCreateLinkHook.php

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


Details

[edit]

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.