Manual:Hooks/SkinBuildSidebar

From MediaWiki.org
Jump to: navigation, search
SkinBuildSidebar
Available from version 1.14.0
At the end of Skin::buildSidebar().
Define function:
public static function onSkinBuildSidebar( Skin $skin, &$bar ) { ... }
Attach hook:
$wgHooks['SkinBuildSidebar'][] = 'MyExtensionHooks::onSkinBuildSidebar';
Called from: File(s): Skin.php

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


Details[edit | edit source]

  • $skin: Skin object
  • &$bar: Sidebar contents

Modify $bar to add or modify sidebar portlets.

Simple Example[edit | edit source]

$wgHooks['SkinBuildSidebar'][] = 'fnNewSidebarItem';
 
function fnNewSidebarItem( $skin, &$bar ) {
        $out = "<ul>\n";
        $out .= "<li>Test</li>\n";
        $out .= "</ul>\n";
        $bar[ 'name of heading' ] = $out;
        return true;
}