1

Both of these plugin triggers have been mentioned by @Craig in his reply to another question, but what they actually do is not so clear.

In /administrator/components/com_menus/models/menutypes.php you have:

// Allow a system plugin to insert dynamic menu types to the list shown in menus:
JEventDispatcher::getInstance()->trigger('onAfterGetMenuTypeOptions', array(&$list, $this));

In /administrator/components/com_menus/views/items/view.html.php you have:

// Allow a system plugin to insert dynamic menu types to the list shown in menus:
JEventDispatcher::getInstance()->trigger('onBeforeRenderMenuItems', array($this));
  1. Can anyone explain what is the difference betweeen these two triggers? From the comments in the code it makes you think they do the same thing.

  2. Rather than add a menu type, would it be possible to remove?

1 Answer 1

2

The main difference between any plugin triggers is the timing at which they run. onAfterGetMenuTypeOptions is triggered after the menu types are returned, and onBeforeRenderMenuItems is triggered just before the menu items are rendered.

The comment in the code is really just a copy and paste issue (hopefully it'll get fixed).

1
  • The onAfter and onBefore bit I get. I was wanting to understand better what each function does. As I understand it onAfterGetMenuTypeOptions allows you to add more menu types when you are creating menu items for the joomla frontend menus. Is there possibility to remove a menu type option? Instead the onBeforeRenderMenuItems is not so clear to me. Does this allow us to add an actual menu item to the joomla backend menu? Commented Nov 28, 2017 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.