aebe422102e9b4b49f60b8caafad9b68114a6f84
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / menu_local_tasks_alter.twig
1 /**
2  * Implements hook_menu_local_tasks_alter().
3  */
4 function {{ machine_name }}_menu_local_tasks_alter(&$data, $route_name, \Drupal\Core\Cache\RefinableCacheableDependencyInterface &$cacheability) {
5
6   // Add a tab linking to node/add to all pages.
7   $data['tabs'][0]['node.add_page'] = [
8       '#theme' => 'menu_local_task',
9       '#link' => [
10           'title' => t('Example tab'),
11           'url' => Url::fromRoute('node.add_page'),
12           'localized_options' => [
13               'attributes' => [
14                   'title' => t('Add content'),
15               ],
16           ],
17       ],
18   ];
19   // The tab we're adding is dependent on a user's access to add content.
20   $cacheability->addCacheTags(['user.permissions']);
21 }