1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Showcase Nav Tab Order

Discussion in 'Showcase Support' started by Shelley, Jun 20, 2013.

  1. Shelley

    Shelley Member Showcase

    Hi bob,

    I got the e-mail (part 2) and just wanted to thank you for sending this out and providing the info, excellent communication and very much appreciated. :)

    I installed xf 1.2 beta and noticed the showcase Tab displays before the "Members" Tab. Is there any chance you could implement it so "showcase" tab in the navigation comes after the members tab?

    Great product, and currently testing it on 1.2 beta and will report any issues if I find any.
     
    Bob likes this.
  2. Shelley

    Shelley Member Showcase

    Actually hold that thought. I'm not overly fussed that it comes before the members tab. Ignore this suggestion :D
     
    Bob likes this.
  3. Bob

    Bob Developer Staff Member

    Just for future reference (and this pertains to ALL addons)

    There are 3 dynamic insert positions for Tabs.

    <!-- extra tabs: home -->
    <!-- extra tabs: middle -->
    <!-- extra tabs: end -->

    home = inserted between the HOME Tab and FORUM Tab.
    middle = inserted between the FORUM tab and MEMBERS tab
    end = inserted after the MEMBERS Tab

    Addon use a listener to inject a tab into one of those three positions by adding values into the $extraTabs array.

    Here is an example of the one for showcase. As you look at the below code, you will see an array key named 'position' and its assignment value is 'middle'. If you changed that to 'end', the showcase tab would display after the MEMBER tab. If you set it to 'home' it would display after the HOME Tab and before the FORUM Tab.

    PHP:
    class NFLJ_Showcase_Listener_Template
    {

    // bunch of methods removed for this example....

       
    public static function navigationTabs(array &$extraTabs$selectedTabId)
        {
            
    $visitor XenForo_Visitor::getInstance();
            
    $itemCounter XenForo_Application::get('options')->scItemCounter;
       
            if (
    $visitor->hasPermission('nfljsc''viewShowcase'))
            {
                
    $scItemModel XenForo_Model::create('NFLJ_Showcase_Model_Item');
                   
                
    $itemIds = array();
                if (
    $visitor['user_id'] && $itemCounter)
                {
                    
    $itemIds $scItemModel->getUnviewedItemIds($visitor['user_id']);
                }
                   
                
    $counter = ($itemIds count($itemIds) : false);
                   
                
    $extraTabs['showcase'] = array(
                    
    'title' => new XenForo_Phrase('nflj_showcase_menu_main_tab'),
                    
    'href' => XenForo_Link::buildPublicLink('full:showcase'),
                    
    'position' => 'middle',
                    
    'counter' => $counter,
                    
    'linksTemplate' => 'nflj_showcase_tab_links'
                
    );
            }
        }
    }
    As far as ORDER goes for dynamically inserted tabs, each listener has a Callback Execution Order. The default is set at 10, which most addon developers just leave it set at. However, you can (in debug mode) via the development tab >> Code Event Listeners >> edit the navigation_tabs listener for each addon and adjust the Callback Execution Order to set the order of the tabs the way you want them. I'd personally only increase them in steps of 1, not 1000s lol

    so if you had 3 dynamically inserted tabs in the middle and you want them in a specific order, edit each one of those navigation_tabs listeners and set one to 11, one to 12 and one to 13 and they should appear in the order you want them to :)

    too much info? :D
     
    Last edited: Nov 4, 2014
  4. Shelley

    Shelley Member Showcase

    You've explained it very well Bob and will try this just to satisfy my curiosity. Thanks so much for the support you're an absolute star. :)
     
    Bob likes this.
  5. beanfan78

    beanfan78 Member Article Mgmt System EA Showcase EA

    Bob, I am trying to move the Showcase Tab to the home position and have the navigation as such 1. Showcase 2. Forums 3. Members. I must have read this 20 times and searched a bunch of times. What template can I edit to get this to happen? I either don't understand your instructions or things have changed in the new version. Please help me :)
     
  6. Bob

    Bob Developer Staff Member

    To do what you want requires a CODE edit in a FILE.

    You need to edit the file /library/NFLJ/Showcase/Listener/Template.php

    The last method in that file (which is a public static function named "navigationTabs") is the method shown above in the example.

    You simply need to change the position from 'middle' to 'home'
     
    NyteWytch likes this.
  7. BT012SS

    BT012SS Active Member Article Mgmt System EA Showcase Pickem

    And after this, you have to delete the path to the "Home Page URL" :)

    [​IMG]
     
  8. beanfan78

    beanfan78 Member Article Mgmt System EA Showcase EA

    Thank you to both! Looks perfect now.
     
  9. Nobitakung

    Nobitakung New Member Showcase

  10. Richard Kras

    Richard Kras New Member Showcase

    For us XenForo Noobs out there, in order to enter DEBUG mode in the Development Tab, you need to download and install the Enable Debug Mode Addon from here Enable Debug Mode From AdminCP
    This will allow you to enable Debug Mode on your Admin Home page and then go into the newly added Development tab to edit the Showcase navigation_tabs Event Listener. I changed mine from 10 to 1 and it put the showcase tab to the right of the Forums Tab.
     
  11. BT012SS

    BT012SS Active Member Article Mgmt System EA Showcase Pickem

    Yes, this works until the next update of the addon. Than you get back your "10" :mad: :cool: