Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom tab button with external link?

Using Mediawiki 1.19 and want to add tabs with external links right next to the tab buttons 'Page' and 'Discussion'. How to do it?

  • Extension:DynamicTabs does not work because it has trouble with vector skins.
  • Steps in FAQ: How do I add/remove tabs throughout my wiki? do not have any effect at all.
like image 415
user1635398 Avatar asked Jan 01 '26 20:01

user1635398


1 Answers

The code in the FAQ was outdated. For newer versions of MediaWiki, you have to use the SkinTemplateNavigation hook instead of the SkinTemplateContentActions hook. I updated the FAQ. Basically, you need to do something like this:

$wgHooks['SkinTemplateNavigation'][] = 'replaceTabs';
function replaceTabs( $skin, &$links) {  
        $links['namespaces']['name_of_tab'] = array(
                'class' => false or 'selected', // if the tab should be highlighted
                'text' => 'text_of_tab', // what the tab says
                'href' => 'url_to_point_to', // where it links to
                'context' => 'main',
        );
        return true;
}
like image 118
Christian Avatar answered Jan 03 '26 15:01

Christian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!