OctoberCMS registerNavigation wrong status of current active submenu link
I have been using OctoberCMS(Builder Plugin) to create different plugins, which works well.
I have a plugin called as Partners and in Plugin.php file code , I have below code.
Plugin.php code
public function registerNavigation()
{
return [
'modules' => [
'label' => 'Modules',
'url' => Backend::url('technobrave/partners/partners'),
'icon' => 'icon-bars',
'permissions' => ['Technobrave.Partner.*'],
'sideMenu' => [
'partner' => [
'label' => 'Partners',
'icon' => 'icon-thumbs-up',
'url' => Backend::url('technobrave/partners/partners'),
'permissions' => ['Technobrave.Partner.*']
],
'team' => [
'label' => 'Team',
'icon' => 'icon-group',
'url' => Backend::url('technobrave/team/team'),
'permissions' => ['Technobrave.Team.*']
]
]
]
];
}
And here below is my Partners.phpcontroller file code
Partners.php controller code
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Technobrave.Partners', 'modules', 'team');
}
Everything works fine apart from my current active class, even if I am on the Partners page, it is still selecting "Team" as current menu link. Below is the screen shot with browser URL for better understanding.
As you can see above, I am on Partners page still its showing current active URL as Team page. Can someone help me how to handle this ?
Thanks
PS: Added PHP
tag if someone tag just for the shake of help I need if someone knows and had ever come across using this CMS.
Answer
You need to set the menu context for each controller.
For the Partners.php
use this:
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Technobrave.Partners', 'modules', 'partner');
}
And for the Team.php
use this:
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Technobrave.Partners', 'modules', 'team');
}
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?