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

How to add sublinks to navbar

Discussion in 'XenForo Development Discussions' started by Diddy8000, Aug 23, 2016.

  1. Diddy8000

    Diddy8000 Member

    Hello,

    Just trying to work out how I would add sublinks to the navbar for a custom navtab I have already made.
    I would want to achieve this though template hooks.

    Here is my current class for adding the Nav Tab
    Code:
    public static function addNavTab(array & $extraTabs, $selectedTabId)
        {
          $addonIsActive = XenForo_Application::get('options')->enableTicketSupport;
    
          if($addonIsActive)
          {
             $extraTabs['mynavmenu1'] = array(
                'title' => new XenForo_Phrase('Tickets'),
                'href' => XenForo_Link::buildPublicLink('full:tickets'),
                'linksTemplate' => 'TicketSupport_QuickLinks',
                'selected' => ($selectedTabId == 'tickets'),
                'position'  =>  'middle'
             );
          }
        }
    
    I'm wanting to add the links to the subnav bar
    [​IMG]

    Any advice would be very helpful!

    Thanks,
    Josh
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    I may be misunderstanding but you have defined the template:
    Code:
    'linksTemplate' => 'TicketSupport_QuickLinks',
    So you would add the links there.
     
  3. Diddy8000

    Diddy8000 Member

    @Brogan Think you have it spot on, I may be getting confused also but in that template I have
    Code:
    <ul class="secondaryContent blockLinksList">
    <li><a href="http://www.example.com/link1" target="_blank">Open New Ticket</a></li>
    <li><a href="http://www.example.com/link1" target="_blank">Your Tickets</a></li>
    </ul>
    
    That adds the quick-links in the drop down of tickets tab, I'm guessing I am missing code for it to appear in sub nav when selected.

    ------ Doh -----
    Nailed it.. in the listener I didn't define the tab's name which prevented the links showing
     

Share This Page