You are here

function menu_per_role_translated_menu_link_alter in Menu Per Role 7

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

Implements hook_translated_menu_link_alter().

Before a menu item gets displayed, the core calls the hook: hook_translated_menu_link_alter(&$item, $map); (but only if $item['options']['alter'] is TRUE)

This function is used to alter the access right based on the role definition of the item.

File

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

Code

function menu_per_role_translated_menu_link_alter(&$item, $map) {

  // Avoid checking the role if the item access is already false.
  if ($item['access'] && _menu_per_role_access($item['mlid']) === FALSE) {
    $item['access'] = FALSE;
  }
}