You are here

function total_control_menu_local_tasks_alter in Total Control Admin Dashboard 7.2

Implements hook_menu_local_tasks_alter().

File

./total_control.module, line 67

Code

function total_control_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if ($router_item['page_callback'] == 'views_page' && $router_item['page_arguments'][0] == 'control_content') {
    if ($router_item['page_arguments'][1]) {
      $pattern = '/^page_tc_([\\S]*)/';
      if (preg_match($pattern, $router_item['page_arguments'][1], $matches)) {
        $content_type = node_type_get_type($matches[1]);
        if (user_access('create ' . $content_type->type . ' content')) {
          $type_url_str = str_replace('_', '-', $content_type->type);
          $item = menu_get_item('node/add/' . $type_url_str);
          $item['title'] = t('Add %type', array(
            '%type' => $content_type->name,
          ));
          if ($item['access']) {
            $data['actions']['output'][] = array(
              '#theme' => 'menu_local_action',
              '#link' => $item,
            );
          }
        }
      }
    }
  }
}