Manipulating the components admin menu

For Joomla! 4.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
User avatar
foto50
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon May 14, 2007 9:47 am

Manipulating the components admin menu

Post by foto50 » Thu May 26, 2022 3:33 pm

Hi all

I wonder if there would be any way from component side to "manipulate" it's own admin menu items "on the fly".

E.g. in my component (jOpenSim) are several configuration options to enable/disable certain features (via com_config and config.xml). While the view (and so the menu entry) is essential when this feature is enabled, it makes no sense when disabled. Currently I solve it with loading a different layout inside the view with kinda "this feature is disabled"-message. But imho it would be cleaner, if this menu item simply does not show up at all when disabled ... so I'ld like to remove it if feature is disabled.

On the other side I have a few views, that do not "deserve" their own menu item at all (kinda "misc") but for a cleaner coding got their own MVC structure. This is probably more an atum template concern, but would like to tell the admin template to highlight &view=misc as active menu item even when working in &view=misc_sub1 or so.

Thanks for any hints
FoTo50

User avatar
ceford
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Manipulating the components admin menu

Post by ceford » Fri May 27, 2022 9:54 am

I doubt it! You may be able to do something with a menu override. But you would have to parse each li and check if it were in your disabled list. Not easy because they don't have ids or classes you can manipulate on installation. You would need to use the link.

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2189
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Manipulating the components admin menu

Post by SharkyKZ » Fri May 27, 2022 11:10 am

Components don't have such functionality yet. For now you could use a system plugin with onPreprocessMenuItems event which you could package with your component.


Post Reply

Return to “Joomla! 4.x Coding”