Manual:Hooks/SkinTemplateTabs

From MediaWiki.org
Jump to: navigation, search
SkinTemplateTabs
Available from version 1.6.0 (r12033)
Removed in version 1.18.0

Define function:
public static function onSkinTemplateTabs( $skin, &$content_actions ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SkinTemplateTabs": [
			"MyExtensionHooks::onSkinTemplateTabs"
		]
	}
}

For MediaWiki ≤1.25:

$wgHooks['SkinTemplateTabs'][] = 'MyExtensionHooks::onSkinTemplateTabs';
Called from: File(s): SkinTemplate.php

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

If you're wondering why your extension broke with the Vector skin, please see Manual:Hooks/SkinTemplateNavigation. Vector uses a different hook.


Warning Warning: MediaWiki 1.18 now uses the Vector-style hook for all skins, please see Manual:Hooks/SkinTemplateNavigation for the vector and 1.18 equivalent of this hook.

Details[edit]

Called after building the $content_actions array, but before returning it. The $content_actions array can be modified to add/remove tabs.

Typically if you want to add new tab with caption mytab that has hyperlink to the page http://ex.org/mypage you should add a new element to the $content_actons array in your function :

 $content_actions['newtab'] = array (
 'class' => false,
 'text'  => 'mytab',
 'href'  => 'http://ex.org/mypage',
);
  • Tip: Always return true, otherwise other extensions that have hooked this event will not function properly!

Arguments[edit]

  • $skin: the skin it was called from
  • $content_actions: The array of content actions. Each content action is an array that includes text of the caption of the tab and hyperlink.