/** * Implements hook_menu_local_tasks_alter(). */ function {{ machine_name }}_menu_local_tasks_alter(&$data, $router_item, $root_path) { // Add an action linking to node/add to all pages. $data['actions']['output'][] = array( '#theme' => 'menu_local_task', '#link' => array( 'title' => t('Add new content'), 'href' => 'node/add', 'localized_options' => array( 'attributes' => array( 'title' => t('Add new content'), ), ), ), ); // Add a tab linking to node/add to all pages. $data['tabs'][0]['output'][] = array( '#theme' => 'menu_local_task', '#link' => array( 'title' => t('Example tab'), 'href' => 'node/add', 'localized_options' => array( 'attributes' => array( 'title' => t('Add new content'), ), ), ), // Define whether this link is active. This can be omitted for // implementations that add links to pages outside of the current page // context. '#active' => ($router_item['path'] == $root_path), ); }