Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / menu_link_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/menu_link_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/menu_link_alter.twig
new file mode 100644 (file)
index 0000000..f3e9580
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Implements hook_menu_link_alter().
+ */
+function {{ machine_name }}_menu_link_alter(&$item) {
+  // Make all new admin links hidden (a.k.a disabled).
+  if (strpos($item['link_path'], 'admin') === 0 && empty($item['mlid'])) {
+    $item['hidden'] = 1;
+  }
+  // Flag a link to be altered by hook_translated_menu_link_alter().
+  if ($item['link_path'] == 'devel/cache/clear') {
+    $item['options']['alter'] = TRUE;
+  }
+  // Flag a link to be altered by hook_translated_menu_link_alter(), but only
+  // if it is derived from a menu router item; i.e., do not alter a custom
+  // menu link pointing to the same path that has been created by a user.
+  if ($item['link_path'] == 'user' && $item['module'] == 'system') {
+    $item['options']['alter'] = TRUE;
+  }
+}