CiviBooking currently uses a CiviCRM hook to create all menu items. This makes menu management difficult (user cannot move or edit them). The problem can be solved by changing to add/remove menu items on installation/uninstallation.
Before
Menu items for the extension were being added using civicrm_navigationMenu hook.
After
Added logic to upgrader to:
Create menu items in DB on extension installation and upgrade
Remove menu items on extension uninstallation
Set menu items inactive on extension disablement
Set menu items active on extension enablement
Comments
It was not possible to use API to create menu items, as there is a bug currently where if you use the API to create a menu item, and then try to use that menu item as parent of other menu items, the system will throw an exception alerting the parent item is not a valid option, both if using menu item's name or ID. This happens because the list of options (ie. existing navigation menu items) is cached on a class' static attribute the first time the API is called to add a menu item (CRM_Core_PseudoConstant::$cache), so none of the recently added menu items will be available to use as parents.
Overview
CiviBooking currently uses a CiviCRM hook to create all menu items. This makes menu management difficult (user cannot move or edit them). The problem can be solved by changing to add/remove menu items on installation/uninstallation.
Before
Menu items for the extension were being added using civicrm_navigationMenu hook.
After
Added logic to upgrader to:
Comments
It was not possible to use API to create menu items, as there is a bug currently where if you use the API to create a menu item, and then try to use that menu item as parent of other menu items, the system will throw an exception alerting the parent item is not a valid option, both if using menu item's name or ID. This happens because the list of options (ie. existing navigation menu items) is cached on a class' static attribute the first time the API is called to add a menu item (CRM_Core_PseudoConstant::$cache), so none of the recently added menu items will be available to use as parents.