function MenuTestHooks::menuLinksDiscoveredAlter
Implements hook_menu_links_discovered_alter().
File
-
core/
modules/ system/ tests/ modules/ menu_test/ src/ Hook/ MenuTestHooks.php, line 19
Class
- MenuTestHooks
- Hook implementations for menu_test.
Namespace
Drupal\menu_test\HookCode
public function menuLinksDiscoveredAlter(&$links) : void {
// Many of the machine names here are slightly different from the route name.
// Since the machine name is arbitrary, this helps ensure that core does not
// add mistaken assumptions about the correlation.
$links['menu_test.menu_name_test']['menu_name'] = menu_test_menu_name();
$links['menu_test.context']['title'] = \Drupal::config('menu_test.menu_item')->get('title');
// Adds a custom menu link.
$links['menu_test.custom'] = [
'title' => 'Custom link',
'route_name' => 'menu_test.custom',
'description' => 'Custom link used to check the integrity of manually added menu links.',
'parent' => 'menu_test',
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.