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

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.webp

2. Have created a route prefix -

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


3. Written some code -

PHP:
class AppsAdmin_Route_Admin_Index implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_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]
 
"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?
 
"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?
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.
 
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.
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.
 
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.

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
 
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".
 
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".

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
 
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".
Wow! That got the job done!

Screen Shot 2015-11-07 at 8.40.10 AM.webp
 
Back
Top Bottom