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

XF 1.2 How to change navigation menu items of custom addons

Discussion in 'Styling and Customization Questions' started by tajhay, Jan 23, 2014.

  1. tajhay

    tajhay Well-Known Member

    Still bemoaning the fact that XF 1.3 will not get a navigation manager... So heres my question.

    How do i add, remove menu items from addons that appear on my navigation? Is there an easy way to change the order? Can someone please provide some guidance.

    For example, on my site : http://www.nzwarriors.com/ i want to remove the following bolded sub items :
    Player Profile -> Most Active Members

    Do i need to contact the addon developer in each instance?
     
  2. Bob

    Bob Well-Known Member

  3. tajhay

    tajhay Well-Known Member

    Thanks Bob, but i was actually referring to custom addons in general. I wish there was a standard area where admins could go and modify such menu items, or better yet a menu/navigation editor built into xf.

    Do all addons that create a menu item have a *tab_links template? As in that is that the standard naming convention used or is that upto the developer?
     
  4. Bob

    Bob Well-Known Member

    Yes (if they are doing it correctly). Its one of the arguments of the navigations_tabs listener (see below).

    Callback signature:

    array &$extraTabs, $selectedTabId

    Arguments:
    1. array &$extraTabs - you may push additional tabs onto this array. Each tab must be identified with a unique key (see $selectedTabId) and be an array with the following keys:
      • title - title for the main tab
      • href - link for the root of the tab
      • position - currently 'home', 'middle', or 'end'. This controls where the tab will show up in the navigation.
      • linksTemplate - the name of the template that contains the links that will be displayed in the second row. The outer HTML of this template should be a <ul class="secondaryContent blockLinksList">.
    2. string $selectedTabId - the name of the selected tab. Select your tab if this matches.

    This is an example of a basic callback:

    PHP:
    public static function navigationTabs(array &$extraTabs$selectedTabId)
    {
        
    $visitor XenForo_Visitor::getInstance();

        if (
    $visitor->hasPermission('nfljsc''viewShowcase'))
        {
            
    $extraTabs['showcase'] = array(
                
    'title' => new XenForo_Phrase('nflj_showcase_menu_main_tab'),
                
    'href' => XenForo_Link::buildPublicLink('showcase'),
                
    'position' => 'middle',
                
    'counter' => $counter,
                
    'linksTemplate' => 'nflj_showcase_tab_links'
            
    );
        }
    }
     
    tajhay likes this.

Share This Page