0

I have a problem with setting up a CP navigation for my module.

In module's init() I declared the following:

Event::on(
    Cp::class,
    Cp::EVENT_REGISTER_CP_NAV_ITEMS,
    function (RegisterCpNavItemsEvent $event) {
        $event->navItems[] = [
            'url' => 'asset-checker-module/broken-links',
            'label' => 'Checker',
            'subnav' => [
                'broken-links' => [
                    'url' => 'asset-checker-module/broken-links',
                    'label' => 'Fehlerhafte Links'
                ],
                'unused-assets' => [
                    'url' => 'asset-checker-module/unused-assets',
                    'label' => 'Nicht verwendete Dateien'
                ]
            ]
        ];
    }
);

So I see my main navigation item, when I click on it, the subnavigation gets expanded, the first element is active. But when I click on the second item, parent item gets collapsed.

I tried to fix it by setting selectedSubnavItem in my template, it did not help.

Any ideas?


Running Craft 3.2.7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.