This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

RedMarlin
RedMarlin

Im sure that Im missing something obvious, but cant figure out what. I have declared the menu context in my controller:

 public function __construct()
    {
        parent::__construct();
        BackendMenu::setContext('RedMarlin.Faq', 'faq', 'categories');
    }

and obviously I have the menu declaration in plugin.php:

public function registerNavigation()
    {
        return [
            'faq' => [
                'label'       => 'FAQ',
                'url'         => Backend::url('redmarlin/faq/faq'),
                'icon'        => 'icon-comments',
                'permissions' => ['redmarlin.faq.*'],

                'sideMenu'    => [
                    'question' => [
                            'label' => 'Questions',
                            'icon'        => 'icon-question-circle',
                            'url'         => Backend::url('redmarlin/faq/faq'),
                            'permissions' => ['redmarlin.faq.*']

                    ],
                    'category' => [
                            'label' => 'Categories',
                            'icon'        => 'icon-list-ul',
                            'url'         => Backend::url('redmarlin/faq/categories'),
                            'permissions' => ['redmarlin.faq.*']
                    ]
                ]
            ]
        ];
    }

but when clicked on categories (or any other controller from my plugin) side menu item remains inactive. Only the top menu is highlighted as it should. What am I missing?

Last updated

philipptempel
philipptempel

I think the problem is that your key in the sideMenu array is singular while the argument to setContext is plural. It should thus be

public function registerNavigation()
    {
        return [
            'faq' => [
                'label'       => 'FAQ',
                'url'         => Backend::url('redmarlin/faq/faq'),
                'icon'        => 'icon-comments',
                'permissions' => ['redmarlin.faq.*'],

                'sideMenu'    => [
                    'questions' => [
                            'label' => 'Questions',
                            'icon'        => 'icon-question-circle',
                            'url'         => Backend::url('redmarlin/faq/faq'),
                            'permissions' => ['redmarlin.faq.*']

                    ],
                    'categories' => [
                            'label' => 'Categories',
                            'icon'        => 'icon-list-ul',
                            'url'         => Backend::url('redmarlin/faq/categories'),
                            'permissions' => ['redmarlin.faq.*']
                    ]
                ]
            ]
        ];
    }
RedMarlin
RedMarlin

Thats it! You are absolutely right. Thanks a lot! I knew it was some stupid mistake :)

adeerwin1422544
adeerwin1422544

thanks,

it works!!!!

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.