如何与外部链接添加自定义选项卡按钮?(How to add custom tab button wi

2019-09-21 22:50发布

使用Mediawiki的1.19,并希望与外部链接添加标签旁边的标签按钮“页面”和“讨论”。 怎么做?

  • 扩展:DynamicTabs不起作用,因为它与矢量皮肤的麻烦。
  • 步骤常见问题:如何添加/删除我的整个维基标签? 没有任何效果可言。

Answer 1:

在常见问题中的代码已经过时。 对于链接到MediaWiki的更新版本,您必须使用SkinTemplateNavigation钩子代替的SkinTemplateContentActions钩。 我更新的常见问题 。 基本上,你需要做的是这样的:

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


文章来源: How to add custom tab button with external link?