Manual:Hooks/CanonicalNamespaces

From MediaWiki.org
Jump to: navigation, search
CanonicalNamespaces
Available from version 1.17.0 (r71576)
For extensions adding their own namespaces or altering the defaults.
Define function:
public static function onCanonicalNamespaces( array &$namespaces ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"CanonicalNamespaces": "MyExtensionHooks::onCanonicalNamespaces"
	}
}

For MediaWiki ≤1.25:

$wgHooks['CanonicalNamespaces'][] = 'MyExtensionHooks::onCanonicalNamespaces';
Called from: File(s): Namespace.php

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

Details[edit]

  • &$namespaces: Array of namespace numbers with corresponding canonical names