verbb / cp-nav

Control Panel Nav is a Craft CMS plugin to help manage your Control Panel navigation.
MIT License
130 stars 11 forks source link

After craft 3->4 upgrade, this plugin doesnt allow to show manually added menu items #129

Open taya13 opened 7 months ago

taya13 commented 7 months ago

Describe the bug

When I disable or uninstall CP NAV plugin, my menu items are there. When I install or enable - they are not in the menu, nor within CP_NAV plugin. image image image This is how I register them: image

Steps to reproduce

  1. create my own module
  2. register admin menu items

Application Info PHP version 8.0.23 OS version Linux 5.15.133+ Database driver & version MySQL 5.7.32 Image driver & version GD 8.0.23 Craft edition & version Craft Pro 4.7.1 Yii version 2.0.48.1 Twig version v3.4.3 Guzzle version 7.8.1

Plugins Button Box 4.2.0 Control Panel Nav 4.0.11 Cookies 4.0.0 Field Manager 3.0.8 Google Cloud Storage 2.0.0 Navigation 2.0.25 Neo 4.0.3 oEmbed 3.0.7 Redactor 3.0.4 Redactor Anchors 1.4.1 Redactor Tweaks 3.0.1 Retour 4.1.14 Schedule 0.4.0 SEOmatic 4.0.38 Similar 4.0.0 Twigpack 4.0.0-beta.4 Typed link field 2.1.5 View Count 1.2.2 Vizy 2.1.15 Workflow 2.0.8

Modules site-module sitemodule\SiteModule scout scout\Scout codeeditor nystudio107\codeeditor\CodeEditor verbb-base verbb\base\Base debug craft\debug\Module

Craft CMS version

4.7.1

Plugin version

4.0.11

Multi-site?

No

Additional context

No response

engram-design commented 7 months ago

For now, custom menu items defined in a module won't work, as both CP Nav and your module use the same event (Cp::EVENT_REGISTER_CP_NAV_ITEMS) to register items. As such, there's a collision between what is processed first, which is typically CP Nav, before your module.

The workaround is to create those nav items as manual CP Nav items. This is until we figure out a mechanism to listen to other events that make use of this event.