Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / menu_local_tasks_alter.twig
index 656f0871eee6b00c1474aa726a067d25bd8f5a2e..aebe422102e9b4b49f60b8caafad9b68114a6f84 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * Implements hook_menu_local_tasks_alter().
  */
-function {{ machine_name }}_menu_local_tasks_alter(&$data, $route_name) {
+function {{ machine_name }}_menu_local_tasks_alter(&$data, $route_name, \Drupal\Core\Cache\RefinableCacheableDependencyInterface &$cacheability) {
 
   // Add a tab linking to node/add to all pages.
   $data['tabs'][0]['node.add_page'] = [
@@ -16,4 +16,6 @@ function {{ machine_name }}_menu_local_tasks_alter(&$data, $route_name) {
           ],
       ],
   ];
+  // The tab we're adding is dependent on a user's access to add content.
+  $cacheability->addCacheTags(['user.permissions']);
 }