I'm trying to add a menu item for my extension to the existing "Memberships" menu. The documentation suggests the following:

Use the Civix implementation

Civix comes with helper functions _EXTENSION_NAME_civix_insert_navigation_menu and _EXTENSION_NAME_civix_navigation_menu that simplify the process of inserting menu items. Consider using these functions rather than using the examples below or writing your own implementation of this hook.

What it doesn't do is give you any clue how to do this. I found an example here: https://github.com/totten/civix/blob/master/UPGRADE.md.

Regardless, there is no info on how to actually add a menu item to an existing menu using this method.

Could someone please enlighten me on how to use the civix method to add a menu item as a child to an existing menu?

2 Answers 2



 * Implements hook_civicrm_navigationMenu().
 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu/
function dmfactuurlink_civicrm_navigationMenu(&$menu) {

  _dmfactuurlink_civix_insert_navigation_menu($menu, 'Administer', array(
    'label' => E::ts('Domus Medica Factuur Link Instellingen'),
    'name' => 'dmafctuurlink_setting',
    'url' => 'civicrm/dmfactuurlink/form/setting',
    'permission' => 'administer CiviCRM',
    'attributes' => [],
    'operator' => 'OR',
    'separator' => 0,
  • Is there a specific part of this that lets me change the position (weight) of the link within the menu hierarchy?
    – Sleewok
    Commented Feb 14, 2019 at 20:40

I just figured it out. The following line:

_serving_civix_insert_navigation_menu($menu, NULL, array(

should have the name of the parent menu passed as:

_serving_civix_insert_navigation_menu($menu, 'Memberships', array(

That will place the menu item within the existing "Memberships" menu.

Anyone know how to change the position of the menu item?

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.