You are here

function menu_per_role_menu_link_alter in Menu Per Role 7

Same name and namespace in other branches
  1. 6 menu_per_role.module \menu_per_role_menu_link_alter()

Implements hook_menu_link_alter().

By catching that function, we can set the special alter option that will let our module receive a call whenever the menu is ready for display but was not yet displayed. At that time we can mark the access as FALSE.

File

./menu_per_role.module, line 164
Allows restricting access to menu items per role.

Code

function menu_per_role_menu_link_alter(&$item) {

  // TODO: The following marks ALL menu items as alterable. Any time a menu item
  // is saved, it is marked as such. I have no clue, at this time, of a way to
  // avoid such nonsense. Hints welcome!
  menu_per_role_menu_link_update($item);
  $item['options']['alter'] = TRUE;
}