You are here

function bat_unit_menu_local_tasks_alter in Booking and Availability Management Tools for Drupal 7

Implements hook_menu_local_tasks_alter().

File

modules/bat_unit/bat_unit.module, line 483

Code

function bat_unit_menu_local_tasks_alter(&$data, $router_item, $root_path) {

  // Create an action link on the Units admin page for adding new units.
  if ($root_path == 'admin/bat/units') {
    $item = menu_get_item('admin/bat/units/add');
    if ($item['access']) {
      $data['actions']['output'][] = array(
        '#theme' => 'menu_local_action',
        '#link' => $item,
      );
    }
  }
  elseif ($root_path == 'admin/bat/types') {
    $item = menu_get_item('admin/bat/types/add');
    if ($item['access']) {
      $data['actions']['output'][] = array(
        '#theme' => 'menu_local_action',
        '#link' => $item,
      );
    }
  }

  // Create an action link on the Units admin page for adding new units.
  if ($root_path == 'admin/bat/config/types/manage/%/units') {
    $item = menu_get_item($router_item['href'] . '/add');
    if ($item['access']) {
      $data['actions']['output'][] = array(
        '#theme' => 'menu_local_action',
        '#link' => $item,
      );
    }
  }
}