How to control order of tabs at bottom of pages?

Last modified by Vincent Massol on 2017/09/26

There's no perfect answer at the moment, we need a proper API to make this clean (by introducing some proper Extension Point.

However there are ways to make it work. 

However be careful that this is not an API and may break in the future or on some versions of XWiki.

So, you can control tabs and their order by setting the docextra Velocity variable.

To control at the page level, put the following in a page (this is a partial copy/paste of the content of docextra.vm which you could also override in a custom skin):

{{velocity}}
#set ($docextras = [])
## ---- Add the Comments tab
$xwiki.jsfx.use('uicomponents/viewers/comments.js', {'forceSkinAction': true, 'language': ${xcontext.language}})
$xwiki.ssfx.use('uicomponents/viewers/comments.css', true)
#set ($discard = $docextras.add(['Comments', 'comments', $msg.get('docextra.comments'), $doc.getObjects('XWiki.XWikiComments').size(), 'commentsinline.vm', $msg.get('core.shortcuts.view.comments')]))
## ---- Add the Attachments tab
$xwiki.jsfx.use('uicomponents/widgets/upload.js', {'forceSkinAction': true, 'language': ${xcontext.language}})
$xwiki.ssfx.use('uicomponents/widgets/upload.css', true)
$xwiki.jsfx.use('js/xwiki/viewers/attachments.js', {'forceSkinAction': true, 'language': ${xcontext.language}})
$xwiki.ssfx.use('js/xwiki/viewers/attachments.css', true)
#set ($discard = $docextras.add(['Attachments', 'attachments', $msg.get('docextra.attachments'), $doc.getAttachmentList().size(), "attachmentsinline.vm$!{sortAttachmentsBy}", $msg.get('core.shortcuts.view.attachments')]))
## ---- Add the History tab
$xwiki.ssfx.use('uicomponents/pagination/pagination.css', true)##
#set ($discard = $docextras.add(['History', 'history', $msg.get('docextra.history'), -1, 'historyinline.vm', $msg.get('core.shortcuts.view.history')]))
## ---- Add the Information tab
#set ($discard = $docextras.add(['Information', 'information', $msg.get('docextra.information'), -1, 'informationinline.vm', $msg.get('core.shortcuts.view.information')]))
{{/velocity}}

If you wish to have all pages use the same tabs, you can set this variable in layoutExtraVars.vm too.

If all you wish is hide some tabs, please check this guide instead.

Tags:
   

Get Connected