Manual:Hooks/SkinTemplateNavigation::Universal

From MediaWiki.org
Jump to navigation Jump to search
SkinTemplateNavigation::Universal
Available from version 1.18.0 (r79358)
Called on both content and special pages after variants have been added
Define function:
public static function onSkinTemplateNavigation_Universal( SkinTemplate $sktemplate, array &$links ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SkinTemplateNavigation::Universal": "MyExtensionHooks::onSkinTemplateNavigationUniversal"
	}
}
Called from:File(s): SkinTemplate.php
Interface:SkinTemplateNavigation::UniversalHook.php

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

Details[edit]

  • $sktemplate: SkinTemplate object
  • &$links: Structured array of navigation links

Example[edit]


$wgHooks['SkinTemplateNavigation::Universal'][] = function ( $template, &$links ) {
	// add a new namespace tab
	$links['namespaces']['new'] = [
		'class' => '',
		'href' => '#/SkinTemplateNavigationLocalSettings.php',
		'text' => 'SkinTemplateNavigationTab',
	];

	// add a new action
	$links['actions']['new'] = [
		'class' => '',
		'href' => '#/SkinTemplateNavigationLocalSettings.php',
		'text' => 'SkinTemplateNavigation action',
	];

	// add a new view
	$links['views']['new'] = [
		'class' => '',
		'href' => '#/SkinTemplateNavigationLocalSettings.php',
		'text' => 'SkinTemplateNavigation view',
	];
};

See also[edit]