Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / menu_local_tasks_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/menu_local_tasks_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/menu_local_tasks_alter.twig
new file mode 100644 (file)
index 0000000..656f087
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Implements hook_menu_local_tasks_alter().
+ */
+function {{ machine_name }}_menu_local_tasks_alter(&$data, $route_name) {
+
+  // Add a tab linking to node/add to all pages.
+  $data['tabs'][0]['node.add_page'] = [
+      '#theme' => 'menu_local_task',
+      '#link' => [
+          'title' => t('Example tab'),
+          'url' => Url::fromRoute('node.add_page'),
+          'localized_options' => [
+              'attributes' => [
+                  'title' => t('Add content'),
+              ],
+          ],
+      ],
+  ];
+}