Manual:Hooks/LanguageGetNamespaces

From Linux Web Expert

LanguageGetNamespaces
<translate> Available from <tvar name=1><translate> version <tvar (r95775, codereview)</tvar></translate>
Provide custom ordering for namespaces or remove namespaces.
<translate> Define function:</translate>
public static function onLanguageGetNamespaces( &$namespaces ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"LanguageGetNamespaces": "MediaWiki\\Extension\\MyExtension\\Hooks::onLanguageGetNamespaces"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> ../languages/Language.php
<translate> Interface:</translate> LanguageGetNamespacesHook.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:LanguageGetNamespaces extensions</tvar>.</translate>


File:OOjs UI icon notice-destructive.svg <translate> Warning:</translate> Do not use this hook to add namespaces. Use CanonicalNamespaces for that.

Details

  • &$namespaces: Array of namespaces indexed by their numbers