You are here

function commerce_order_types_menu_local_tasks_alter in Commerce Order Types 7

Implements hook_menu_local_tasks_alter().

File

./commerce_order_types.module, line 36
Provides a UI for creating and managing custom order types.

Code

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

  // Add action link 'admin/commerce/orders/add' on 'admin/commerce/orders'.
  if ($root_path == 'admin/commerce/orders') {
    foreach (commerce_order_types_order_types() as $type => $order_type) {
      $type_arg = strtr($type, '_', '-');
      $item = menu_get_item('admin/commerce/orders/add/' . $type_arg);
      if ($item['access']) {
        $item['title'] = 'Create ' . $order_type->name . ' order';
        $data['actions']['output'][] = array(
          '#theme' => 'menu_local_action',
          '#link' => $item,
        );
      }
    }
  }
}