You are here

function profile2_menu_local_tasks_alter in Profile 2 7

Same name and namespace in other branches
  1. 7.2 profile2.module \profile2_menu_local_tasks_alter()

Implements hook_menu_local_tasks_alter().

Adds a local task to the profiles admin page to jump to permissions for profiles.

File

./profile2.module, line 146
Support for configurable user profiles.

Code

function profile2_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if ($root_path == 'admin/structure/profiles') {
    $item = menu_get_item('admin/people/permissions');
    if ($item['access']) {
      $item['title'] = t('Manage permissions');
      if (module_exists('filter_perms')) {
        $item['href'] .= '/module-profile2';
      }
      else {
        $item['localized_options']['fragment'] = 'module-profile2';
      }
      $item['weight'] = 3;
      $data['actions']['output'][] = array(
        '#theme' => 'menu_local_action',
        '#link' => $item,
      );
    }
  }
}