You are here

function menu_test_menu_links_discovered_alter in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/menu_test/menu_test.module \menu_test_menu_links_discovered_alter()
  2. 10 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
Module that implements various hooks for menu tests.

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',
  ];
}