How to add custom tab button with external link?

一笑奈何 提交于 2019-12-12 19:03:41

问题


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.

回答1:


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;
}


来源:https://stackoverflow.com/questions/12192641/how-to-add-custom-tab-button-with-external-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!