1

I'm writing an extension to provide a dashboard of membership numbers specific to our organisation. I have created the extension using civix and edited the navigationMenu function to create a menu entry. I have also created the xxxx.xml file in xml/menu to map the url to the page_callback. Is there another step I need to do?

The menu entry appears ok with the correct url but, when clicked, only displays the civicrm "home page" rather than my function. Is there a way to check if the xml file is being parsed correctly and the mapping stored? I checked civicrm_api3('Navigation', 'get'.. but I can't find entries for other extension menus so maybe this is the wrong place to look.

Any help appreciated.

2

You need to either clear caches or menu rebuild: https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#rebuild-civicrm-menus

|improve this answer|||||
  • Thank you. I had been clearing caches but the Joomla ones not CiviCRM. So simple when you know how. Thanks – Crofter Feb 28 at 16:58
1

There's 2 things that often get thought of as one and the same here.

  1. The "menu" route is specified in your XML file and makes it so if you type the URL correctly you'll get to your code.

  2. The "navigation menu" is usually populated via a hook made easier by civix. Here's an example that adds an item called "Group Growth" under the Contacts menu.

Changes to either of these usually need a cache clear as @Demerit says - I usually prefer cv flush if I'm on the command line, or Administer » System Settings » Cleanup Caches...*

If that's not working...

  • checked your extension is enabled (!)
  • check file permissions on your cache directories (e.g. templates_c) - sometimes if you've been working on the commandline and your webserver runs as a different user then you can end up locking CiviCRM out of being able to write files it needs to.
|improve this answer|||||
  • Thank you. I had been clearing caches but the Joomla ones not CiviCRM. I had been using your GoCardless extension as an example. Can you define the position in the menu or does it always get tacked on the end? Thanks – Crofter Feb 28 at 16:59
  • Ah, yep, that'll do it! Don't forget to mark one of the answers as accepted (with the ✔ button) so everyone knows you're sorted and don't need more answers. – artfulrobot Feb 28 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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