Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / link_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/link_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/link_alter.twig
new file mode 100644 (file)
index 0000000..f088b9c
--- /dev/null
@@ -0,0 +1,9 @@
+/**
+ * Implements hook_link_alter().
+ */
+function {{ machine_name }}_link_alter(&$variables) {
+  // Add a warning to the end of route links to the admin section.
+  if (isset($variables['route_name']) && strpos($variables['route_name'], 'admin') !== FALSE) {
+    $variables['text'] = t('@text (Warning!)', ['@text' => $variables['text']]);
+  }
+}