• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed  Not possible to set selexted extratab without an linktemplate

R

ragtek

Guest
#1
I created a extra tab for a add-on
PHP:
class Ragtek_Linklist_StaticMethods
{
    static public function addTab(array &$extraTabs, $selected)
    {
        $extraTabs['links'] =array(
            'title' => new XenForo_Phrase('ragtekLinklist'),
            'selected' => ($selected == 'links'),
            'href'   => XenForo_Link::buildPublicLink('links'),
        );
    }
}
The normal behaviour would be, that the tab is "selected" when i click on it, but that's not happening.
After spending 2 days searching for a solution and debugging, i found it in the navbar template
I'm not sure if it's working as designed, but IMHO it should also be possible to set the tab as selected without having a linktemplate because i don't need it.

Code:
<xen:if is="{$extraTab.linksTemplate}">
                            <li class="navTab $extraTabId {xen:if $extraTab.selected, 'selected', 'Popup PopupControl PopupClosed'}">
                <a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
.....
.....
</li>
            <xen:else />
                <li class="navTab PopupClosed"><a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a></li>
            </xen:if>
ATM it's not possible to set a tab selected, if you don't have a link template.

I changed
Code:
 <li class="navTab PopupClosed"><a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a></li>
to
Code:
<li class="navTab {xen:if $extraTab.selected, 'selected', 'PopupClosed'}"><a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a></li>
and now it's working
 

Mike

XenForo developer
Staff member
#2
It needs a bit more than that so that the second line of the navigation actually has something, but I have done this for the next release.
 
F

Floris

Guest
#3
It needs a bit more than that so that the second line of the navigation actually has something, but I have done this for the next release.
Ah, so it's not just me. Ok! Thanks for the fix and looking forward to beta 4.

Pssst, timeframe for beta 4 = somewhere during December, despite law suits and holiday season?