function menu_test_menu_links_discovered_alter
Same name in other branches
- 8.9.x core/modules/system/tests/modules/menu_test/menu_test.module \menu_test_menu_links_discovered_alter()
- 10 core/modules/system/tests/modules/menu_test/menu_test.module \menu_test_menu_links_discovered_alter()
- 11.x core/modules/system/tests/modules/menu_test/menu_test.module \menu_test_menu_links_discovered_alter()
Implements hook_menu_links_discovered_alter().
File
-
core/
modules/ system/ tests/ modules/ menu_test/ menu_test.module, line 14
Code
function menu_test_menu_links_discovered_alter(&$links) {
// 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.