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

How do I add my own navigation tab in the adminCP, with my own side column?

Discussion in 'XenForo Development Discussions' started by TheBigK, Nov 6, 2015.

  1. TheBigK

    TheBigK Well-Known Member

    My intention is to add a navigation tab in the adminCP menu, along with the existing ones :

    Home | Applications | Users | Appearance | Tools | MY TAB | Development

    So far -

    1. I have been able to create "My TAB" using Admin Navigation menu.

    Screen Shot 2015-11-06 at 11.51.57 AM.png

    2. Have created a route prefix -

    Screen Shot 2015-11-06 at 11.52.52 AM.png


    3. Written some code -

    PHP:

    class AppsAdmin_Route_Admin_Index implements XenForo_Route_Interface
    {
    public function 
    match($routePathZend_Controller_Request_Http $requestXenForo_Router $router)
    {
    return 
    $router->getRouteMatch('AppsAdmin_ControllerAdmin_Index'$routePath'appsadmin');
    }
    }
    4. ControllerAdmin

    PHP:
    <?php
    class AppsAdmin_ControllerAdmin_Index extends XenForo_ControllerAdmin_Abstract
    {
    public function 
    actionIndex()
    {
    $viewParams = array();
    return 
    $this->responseView('AppsAdmin_ViewAdmin_Index''appsadmin'$viewParams);
    }
    }
    5. Have created an admin template by the name "appsadmin", added a title to it.

    So far so good.

    Problems:

    1. I am wondering why am I not seeing my "Blogger Performance Report" link in the sidebar?

    What's missing?[/code]
     
  2. Jake B.

    Jake B. Well-Known Member

    Did you check 'only show if there are visible children'?
     
  3. TheBigK

    TheBigK Well-Known Member

  4. Robust

    Robust Well-Known Member

    "Blogger performance report" is what you can't see? "Apps Admin" is visible. What's the navigation link info for blogger performance report? Did you tick the 'hide this navigation when there are no viewable children' on it?
     
  5. TheBigK

    TheBigK Well-Known Member

    Well, I do see 'Apps Admin' at proper location. However, when I click on it, I see the contents (sidebar and main panel) from the 'Home' tab. I'd like to see my own left sidebar that lists "Blogger Performance Report" and the main panel should load the contents from my template.
     
  6. Robust

    Robust Well-Known Member

    Oh, right, you're just not seeing the sidebar options. You use a template or something for that, never played around with it so I'm not sure where you set that. Take a look at XF code for the Applications tab or something.
     
  7. batpool52!

    batpool52! Well-Known Member

    Don't set the add-on as "XenForo" or it would be deleted once you upgrade XenForo :LOL:
     
    TheBigK likes this.
  8. Jake B.

    Jake B. Well-Known Member

    You set it in your route as the third parameter in $router->getRouteMatch. Looks like his is already though. If you want to export the add-on and send me the files I can take a look for you @TheBigK
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    The third parameter of getRouteMatch ("appsadmin" in your case) should match the ID of the parent navigation entry that should be activated. Therefore, the navigation ID of your "Apps Admin" navigation should be "appsadmin" rather than "appsAdmin" (or the third paramter of getRouteMatch should be "appsAdmin" instead of "appsadmin".
     
    Jake B. likes this.
  10. Jake B.

    Jake B. Well-Known Member

    Ooh, good catch. Didn't even notice that, was looking at the screenshot of his route prefix configuration and saw that they matched didn't notice he had one of his navigation configuration too
     
  11. TheBigK

    TheBigK Well-Known Member

    Wow! That got the job done!

    Screen Shot 2015-11-07 at 8.40.10 AM.png
     
    adwade and Jake B. like this.

Share This Page