Manual:Hooks/PrefixSearchExtractNamespace

Category:MediaWiki hooks#PrefixSearchExtractNamespace Category:Hooks added in MediaWiki 1.25.0#PrefixSearchExtractNamespace
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onPrefixSearchExtractNamespace"
	}
}
Called from: File(s): search/PrefixSearch.phpCategory:MediaWiki hooks included in PrefixSearch.php#PrefixSearchExtractNamespace, search/SearchEngine.phpCategory:MediaWiki hooks included in SearchEngine.php#PrefixSearchExtractNamespace
Interface: PrefixSearchExtractNamespaceHook.php

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

Details

  • &$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)
Category:Hooks added in MediaWiki 1.25.0 Category:MediaWiki hooks Category:MediaWiki hooks included in PrefixSearch.php Category:MediaWiki hooks included in SearchEngine.php