Manual:Hooks/PrefixSearchExtractNamespace

From MediaWiki.org
Jump to navigation Jump to search
PrefixSearchExtractNamespace
Available from version 1.25.0 (Gerrit change 168167)
Called if core was not able to extract a namespace from the search string so that extensions can attempt it.
Define function:
public static function onPrefixSearchExtractNamespace( &$namespaces, &$search ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"PrefixSearchExtractNamespace": "MyExtensionHooks::onPrefixSearchExtractNamespace"
	}
}

For MediaWiki ≤1.25:

$wgHooks['PrefixSearchExtractNamespace'][] = 'MyExtensionHooks::onPrefixSearchExtractNamespace';
Called from:File(s): search/PrefixSearch.php, search/SearchEngine.php

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

Details[edit]

  • &$namespaces: array of int namespace keys to search in (change this if you can extract namespaces)
  • &$search: search term (replace this with term without the namespace if you can extract one)