CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions »
  • CiviHR (Moderator: totten) »
  • Adding a menu entry to the Administer menu
Pages: [1]

Author Topic: Adding a menu entry to the Administer menu  (Read 2173 times)

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Adding a menu entry to the Administer menu
August 19, 2013, 09:02:28 am
Hi guys,

I've read the tutorial on adding an extension to the menu by filling out the civicrm_civicrm_navigationMenu function.

My question is, how can I add a menu (and hopefully a submenu) to the "Administer" option.

I did a print_r() and go the number 90.

That feels like a hack! Would it even survive a clear cache? Please can you tell me how to add sub menu to an already existing menu in a neater way?

Thanks,
If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Adding a menu entry to the Administer menu
August 19, 2013, 02:32:44 pm
I haven't looked at that hook in a while, but... if the extension is generated by civix, then there's an undocumented helper function called:

_MYEXT_civix_insert_navigation_menu

For example, in the extension org.civicrm.hrjob, the helper is:

https://github.com/civicrm/civihr/blob/master/hrjob/hrjob.civix.php#L178

I believe that $menu is the same data structure provided by the hook. I'm not entirely sure what $path is supposed to be. The $parentId supposed to be optional -- ie you specify the $path, and then it searches for a matching entry. You can probably read/experiment with it a little. Or, if nganivet notices this post, then maybe he can comment (b/c he wrote the helper).

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions »
  • CiviHR (Moderator: totten) »
  • Adding a menu entry to the Administer menu

This forum was archived on 2017-11-26.