Manual:Hooks/CanonicalNamespaces

Category:MediaWiki hooks#CanonicalNamespaces Category:Hooks added in MediaWiki 1.17.0#CanonicalNamespaces
CanonicalNamespaces
Available from version 1.17.0 (r71576, CodeReview archive)
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onCanonicalNamespaces"
	}
}
Called from: File(s): MWNamespace.phpCategory:MediaWiki hooks included in MWNamespace.php#CanonicalNamespaces
Interface: CanonicalNamespacesHook.php

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

To define new namespaces, extensions should prefer extension registration over this hook (more information).

Details

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

This hook has replaced $wgExtraNamespaces.

Category:Hooks added in MediaWiki 1.17.0 Category:MediaWiki hooks Category:MediaWiki hooks included in MWNamespace.php