Manual:Hooks/CanonicalNamespaces
From Linux Web Expert
CanonicalNamespaces | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (r71576, codereview)</tvar></translate> For extensions adding their own namespaces or altering the defaults. | |
<translate> Define function:</translate> | public static function onCanonicalNamespaces( array &$namespaces ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"CanonicalNamespaces": "MediaWiki\\Extension\\MyExtension\\Hooks::onCanonicalNamespaces"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> MWNamespace.php |
<translate> Interface:</translate> | CanonicalNamespacesHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:CanonicalNamespaces extensions</tvar>.</translate>
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.