verbb / cp-nav

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

Disabled plugins (from config) show up in menu #94

Closed AndrewMac closed 2 years ago

AndrewMac commented 3 years ago

Description

I have a few plugins that I use in local development that are disabled on production, using the 'disabledPlugins' config setting in config/general.php.

I have just installed CP Nav and now I find that the menu items for these disabled plugins are appearing in the control panel navigation. There is also no icon showing next to the menu item. The plugins are disabled, though: clicking on the menu results in an error: "Template not found".

Also, the Tag plugin is enabled on both local and dev, but the menu icon is missing on production (not local, strangely enough).

Steps to reproduce

  1. Disable some plugins from production using the 'disabledPlugins' config setting
  2. Check the production site; that plugin might be showing in the nav, but not working

Additional info

Additional context

I just stopped disabling one of the plugins and the icon came back, as expected.

engram-design commented 3 years ago

Yep, that's a valid point I've been trying to deal with. Currently, CP Nav will listen on any plugin being installed, removed or if the user has access to it. These programatic changes like using disabledPlugins don't emit any sort of event.

CP Nav copies all default nav items into its own cache of sorts, and that's used when rendering the sidebar. As such, we need to do work to keep it up to date when you modify the sidebar.

I've planned a larger refactor in the coming months, which will change how the sidebar is rendered, which should address this.

AndrewMac commented 3 years ago

Thanks for the quick reply; it all makes perfect sense! And I'm certainly okay to wait for the refactor, particularly when it's for something that you so kindly offer to people for free.

It does certainly meet a need, though: in my case it's because my clients want quicker access to Commerce products and orders, which are otherwise hidden under the Commerce plugin menu. CP Nav lets me bring them up and pop them right under entries, which suits them so much better. Maybe I should add that as an (optional) feature request for Commerce ;-)

So thanks for all the work on this. I'm sure I'm not the only one that really appreciates it!

engram-design commented 2 years ago

Should be fixed in 4.0.0-beta.2 for Craft 4.

AndrewMac commented 2 years ago

Hi Josh Really sorry! I missed the notice that you'd fixed this, and just saw that you'd closed it. Thanks so much for your help with that! Much appreciated. Have a lovely day.

Cheers, Andrew