Manual:Hooks/SkinTemplateNavigation::SpecialPage

Note Note:

SkinTemplateNavigation::SpecialPage
Available from version 1.18.0 (r79358, codereview)
Removed in version 1.41.0 (Gerrit change 932019)
Called on special pages after the special tab is added but before variants have been added
Define function:
public static function onSkinTemplateNavigation_SpecialPage( SkinTemplate &$sktemplate, array &$links ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"SkinTemplateNavigation::SpecialPage": "MediaWiki\\Extension\\MyExtension\\Hooks::onSkinTemplateNavigationSpecialPage"
	}
}
Called from: File(s): SkinTemplate.php
Interface: SkinTemplateNavigation__SpecialPageHook.php

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


Details

edit
  • &$sktemplate: SkinTemplate object
  • &$links: Structured navigation links

This hook is called just prior to displaying the page navigation links on a Special Page. By modifying &$links you can change the text of the "Special Page" link along with adding other links to the bar.

edit
[
	'namespaces' => [
		'special' => [
			'class' => 'selected',
			'text' => 'Special page',
			'href' => '/wiki/Special:SpecialPageName',
			'context' => 'subject',
		],
	],
	'views' =>  [],
	'actions' =>  [],
	'variants' =>  [],
]

The following code changes "Special Page" to "My Page" and adds a link to Google.

$links['namespaces']['special']['text'] = 'My Page';

$links['namespaces']['google']['text'] = 'Google';
$links['namespaces']['google']['href'] = 'http://www.google.com/';