Manual talk:Hooks/SkinBuildSidebar

From MediaWiki.org
Jump to navigation Jump to search

I guess they may be getting rid of the "printable version" link, so if you want to re-add it (at least on pages in namespace 406), add this to LocalSettings.php:

// Put a "Printable version" link on the sidebar
$wgHooks['SkinBuildSidebar'][] = 'fnNewSidebarItem';
function fnNewSidebarItem( $skin, &$bar ) {
        global $wgContentNamespaces;
        $title = $skin->getRelevantTitle();
        $namespaceNumber = $title->getNamespace();
#	if ( !isset ( $wgContentNamespaces[$namespaceNumber] ) || $namespaceNumber === 0 ) {
        if ( $namespaceNumber !== 406 ) {
                return true;
        }
	$request = $skin->getRequest();
        $url = $title->getFullURL( $request->appendQueryValue( 'printable', 'yes', true ) );
        $out = "<ul>\n";
        $out .= "<li><a href=" . '"' . $url . '"' . ">Printable version</a></li>\n";
        $out .= "</ul>\n";
        $bar[ 'Print/export' ] = $out;
        return true;
}