You are here

function onlyone_menu_local_tasks_alter in Allow a content type only once (Only One) 7

Implements hook_menu_local_tasks_alter().

File

./onlyone.module, line 129
Allows to define if a content type must have more than one node in the site.

Code

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

  // Add action link to 'onlyone/add' on 'admin/content' page.
  if (variable_get('onlyone_new_menu_entry') && $root_path == 'admin/content') {
    $item = menu_get_item('onlyone/add');
    if ($item['access']) {
      $data['actions']['output'][] = array(
        '#theme' => 'menu_local_action',
        '#link' => $item,
        '#weight' => -1,
      );
    }
  }
}