Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / menu_links_discovered_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/menu_links_discovered_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/menu_links_discovered_alter.twig
new file mode 100644 (file)
index 0000000..3c06cd1
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Implements hook_menu_links_discovered_alter().
+ */
+function {{ machine_name }}_menu_links_discovered_alter(&$links) {
+  // Change the weight and title of the user.logout link.
+  $links['user.logout']['weight'] = -10;
+  $links['user.logout']['title'] = new \Drupal\Core\StringTranslation\TranslatableMarkup('Logout');
+  // Conditionally add an additional link with a title that's not translated.
+  if (\Drupal::moduleHandler()->moduleExists('search')) {
+    $links['menu.api.search'] = [
+      'title' => \Drupal::config('system.site')->get('name'),
+      'route_name' => 'menu.api.search',
+      'description' => new \Drupal\Core\StringTranslation\TranslatableMarkup('View popular search phrases for this site.'),
+      'parent' => 'system.admin_reports',
+    ];
+  }
+}