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 (Moderators: mathieu, totten, kasiawaka) »
  • Question re civix and Menu.xml
Pages: [1]

Author Topic: Question re civix and Menu.xml  (Read 1389 times)

awasson

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 7
  • Living in a world of Drupal / CiviCRM
    • My Company: Luna Design
  • CiviCRM version: Latest
  • CMS version: Drupal 6/7/8
  • MySQL version: 5.x
  • PHP version: 5.3.x
Question re civix and Menu.xml
November 04, 2012, 01:50:46 pm
Hi there,

I'm working on an extension to provide the ability to apply (and report) taxes for registrations. I've got civix running on my local machine with a vanila install of Drupal 7 / civiCRM 4.2.4 and everything is working quite well for development as far as I can see.

I'm looking for some pointers on how to configure my menu.xml file so I can add my extension's page to the civiCRM menu system. I've created the basics for the extension and created a dummy configuration page with civix: civix generate:page Configuration civicrm/configuration

That will create my page and stub out the template and controller as well as the menu.xml file but even after I clear the menu cache, the menu item isn't anywhere to be found. I would like to move it down into the Administer menu somewhere, probably by itself. Does anyone have any pointers regarding how I should attempt that? Currently my extension's xml file is as follows:


Code: [Select]

<?xml version="1.0"?>
<menu>
  <item>
    <path>civicrm/civitax</path>
    <page_callback>CRM_Myextension_Page_Configuration</page_callback>
    <title>Configuration</title>
    <access_arguments>access CiviCRM</access_arguments>
  </item>
</menu>

   
My CiviCRM Extension Workshop: https://github.com/awasson

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Question re civix and Menu.xml
November 07, 2012, 08:29:40 am
Good point. In fact, the nomenclature used for Civi's menu is a bit confusing.

In contemporary frameworks, the menu XML files would be called "routes" -- they connect a path to a PHP controller, but they don't determine which items appear in the navigation bar at the top.

There is a hook for declaring new items in the navigation bar. You can implement the hook yourself by following this example:

https://github.com/webaccess/com.webaccessglobal.module.civimobile/blob/c8ac5c99f8c73f9ef313221c1bceaeddfe17ea49/civimobile.php

awasson

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 7
  • Living in a world of Drupal / CiviCRM
    • My Company: Luna Design
  • CiviCRM version: Latest
  • CMS version: Drupal 6/7/8
  • MySQL version: 5.x
  • PHP version: 5.3.x
Re: Question re civix and Menu.xml
November 07, 2012, 10:09:10 am
Fantastic! That was just what I needed to prod me in the right direction!

Using that example of hook_civicrm_navigationMenu I've been able to add my config page.

Thanks so much!

Andrew
My CiviCRM Extension Workshop: https://github.com/awasson

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Question re civix and Menu.xml

This forum was archived on 2017-11-26.