Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / menu_local_tasks_alter.twig
1 /**
2  * Implements hook_menu_local_tasks_alter().
3  */
4 function {{ machine_name }}_menu_local_tasks_alter(&$data, $router_item, $root_path) {
5   // Add an action linking to node/add to all pages.
6   $data['actions']['output'][] = array(
7     '#theme' => 'menu_local_task',
8     '#link' => array(
9       'title' => t('Add new content'),
10       'href' => 'node/add',
11       'localized_options' => array(
12         'attributes' => array(
13           'title' => t('Add new content'),
14         ),
15       ),
16     ),
17   );
18
19   // Add a tab linking to node/add to all pages.
20   $data['tabs'][0]['output'][] = array(
21     '#theme' => 'menu_local_task',
22     '#link' => array(
23       'title' => t('Example tab'),
24       'href' => 'node/add',
25       'localized_options' => array(
26         'attributes' => array(
27           'title' => t('Add new content'),
28         ),
29       ),
30     ),
31     // Define whether this link is active. This can be omitted for
32     // implementations that add links to pages outside of the current page
33     // context.
34     '#active' => ($router_item['path'] == $root_path),
35   );
36 }