Upcoming Events

CiviCRM Europe FOSDEM training camp – Brussels
February 8th, 2010
This 2-day hands-on session is targeted at experienced users, integrators and (more...)

NYC CiviCRM Meeting - February 2010
February 9th, 2010
This next NYC meetup will feature a case study (TBD), group discussions and a (more...)

San Francisco CiviCRM Meetup - February 2010
February 10th, 2010
Come meet others from the Bay Area who are interested in, using or developing (more...)

CiviCRM Seminar - London
February 26th, 2010
MTL Software Solutions are hosting a free seminar at our Central London offices (more...)

CiviCRM Seminar - Dublin
March 18th, 2010
MTL Software Solutions are hosting a free seminar at The IBOA, Stephen St (more...)

CiviCRM User Training - Atlanta (pre NTC)
April 7th, 2010
This full-day hands-on training session is aimed at non-profit staff and (more...)

Configuring and Customizing CiviCRM - Atlanta (after NTC)
April 11th, 2010
This hands-on 1-day training session is targeted at administrators, integrators (more...)

CiviCRM Developer Training - Atlanta (after NTC)
April 12th, 2010
This hands-on 1-day training session is targeted at experienced developers who (more...)

Configuring, Customizing and Extending CiviCRM - San Francisco (before DrupalCon SF)
April 18th, 2010
This hands-on 1-day training session is targeted at administrators, integrators (more...)

CiviCRM User Training - San Francisco (before DrupalCon SF)
April 18th, 2010

This full-day hands-on training session is aimed at non-profit staff and (more...)

CiviCon San Francisco 2010
April 22nd, 2010
Join us for the first ever CiviCon in San Francisco this April! CiviCon brings (more...)

CiviCRM Components

Tools for engaging your supporters...

CiviContribute


CiviEvent


CiviMail


CiviMember


CiviReport


CiviCRM v2.1 Menu Redesign

Not Just a Contact Database

These optional components give you more power to connect and engage your supporters.

  • civiEVENT

  • Online event registration and participant tracking.

  • civiMEMBER

  • Online signup and membership management.

  • civiMAIL

  • Personalized email blasts and newsletters.

  • civiREPORT

  • Report generation and template management.

Fri, 04/18/2008 - 21:12 — lobo

Drupal 6 introduced a new menu system. CiviCRM had modeled its menu system after drupal 4.x which meant we needed to upgrade the menu code significantly to upgrade CiviCRM to Drupal 6. We took the opportunity to learn and understand more from drupal's new system and also simplify the interface between CiviCRM and Drupal with regard to the menu hook.

The CiviCRM menu system has been based on the Drupal menu system, so all credit for the below goes to chx and the Drupal folks (all blame should be assigned to us). We have simplified and extended it a bit to meet our needs. Similar to Drupal menu system, the CiviCRM menu data now resides in the database. civicrm_menu stores all the information for a menu item.

CREATE TABLE civicrm_menu (
     id int unsigned NOT NULL AUTO_INCREMENT  ,
     domain_id int unsigned NOT NULL   ,
     path varchar(255)    COMMENT 'Path Name',
     path_arguments text    COMMENT 'Arguments to pass to the url',
     title varchar(255)    COMMENT 'Menu Title',
     access_callback varchar(255)    COMMENT 'Function to call to check access permissions',
     access_arguments text    COMMENT 'Arguments to pass to access callback',
     page_callback varchar(255)    COMMENT 'function to call for this url',
     page_arguments text    COMMENT 'Arguments to pass to page callback',
     breadcrumb text    COMMENT 'Breadcrumb for the path.',
     component_id int unsigned    COMMENT 'Component that this menu item belongs to',
     is_active tinyint    COMMENT 'Is this menu item active?',
     is_public tinyint    COMMENT 'Is this menu accessible to the public?',
     is_exposed tinyint    COMMENT 'Is this menu exposed to the navigation system?',
     weight int NOT NULL  DEFAULT 1 COMMENT 'Ordering of the menu items in various blocks.',
     type int NOT NULL  DEFAULT 1 COMMENT 'Drupal menu type.',
     page_type int NOT NULL  DEFAULT 1 COMMENT 'CiviCRM menu type.'
)

We now interface with Drupal with only one menu item, i.e. the top level 'civicrm' item which does a callback into the civicrm code. This menu item is not permissioned, i.e. everyone has access. Permissioning is now handled within the CiviCRM menu system, which should make it a bit easier to transition to our ACL based permissioning system (currently being tested in the standalone release).

Instead of storing the menu items as php arrays, we store it in a xml format. The menu xml files are in the civicrm templates directory. The xml files are read only during the menu rebuild process to populate the menu table. This process is run only at install / upgrade time. Hence there is no performance penalty for using xml based storage. This does enable folks to edit and change entries at the xml level if needed. We are also planning to implement "menu hooks" for use by other civicrm modules. This is a significant improvement over the current approach, where folks needed to write their own "invoke file" and hack some civicrm code to integrate other components.

We do a fair amount of computation during menu rebuild. To make things more efficient in the rendering process, we ensure that all menu items have all the database fields. Thus we propagate values for access_callback et al down the path tree if not already specified. We also compute the values for the navigation and admin blocks for the system and also the breadcrumb for each path. This saves on processing and db lookups when we render a civicrm page.

The above changes let us get rid of all the Invoke files in the system. It also makes things more consistent and easier to extend. I suspect there is also some performance impact for the better. Most of the changes described above are implemented and functional in trunk

Comments

Is this going to be for the

Is this going to be for the 2.1 version?

Barry Jenkins - Petition Inc. CEO

Yes, its already part of 2.1 ..

so far, we've been pretty pleased with the results. lets us make a fair amount of changes at the xml level that automatically get managed at the code level

Using CiviCRM for donor management? Vote for CiviCRM at at NTEN Survey: http://www.surveymonkey.com/s.aspx?sm=IyoKNSWjxs882CDPlpAlwA_3d_3d

Can we expect civicrm menu

Can we expect civicrm menu hooks or api functions for easily & dynamically injecting options into menus?

civicrm menu hooks will be implemented for the 2.1 release ..

we dont have it right now in the code base, but i do plan on adding it when we revisit and do some more cleanup / development on the menu system in the next few weeks

Great !

Is this going to be for the 2.1 version ?

As for the menu, are you going to take that opportunity to reorganise it (contentwise) as well ? I've read various comments on the forum about people not finding it intuitive (myself including) and some usability gurues offering to help, has it reached something ?

X+

P.S. Certainly not the right place to ask, but is it possible to use it to create a shortcut block with your own links (eg using profiles) ?

Can you post specific links to the

forums post and the offers to help by usability folks

I'll have to take a look and see how the shortcuts block is created, but potentially it can be moved to the menuing system also

thanx

lobo