function lazy_route_provider_install_test_menu_links_discovered_alter

Same name in other branches
  1. 9 core/modules/system/tests/modules/lazy_route_provider_install_test/lazy_route_provider_install_test.module \lazy_route_provider_install_test_menu_links_discovered_alter()
  2. 8.9.x core/modules/system/tests/modules/lazy_route_provider_install_test/lazy_route_provider_install_test.module \lazy_route_provider_install_test_menu_links_discovered_alter()
  3. 11.x core/modules/system/tests/modules/lazy_route_provider_install_test/lazy_route_provider_install_test.module \lazy_route_provider_install_test_menu_links_discovered_alter()

Implements hook_menu_links_discovered_alter().

1 string reference to 'lazy_route_provider_install_test_menu_links_discovered_alter'
LazyRouteProviderInstallTest::testInstallation in core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php
Tests that the lazy route provider is used during a module install.

File

core/modules/system/tests/modules/lazy_route_provider_install_test/lazy_route_provider_install_test.module, line 11

Code

function lazy_route_provider_install_test_menu_links_discovered_alter(&$links) {
    $message = \Drupal::state()->get(__FUNCTION__, 'success');
    try {
        // Ensure that calling this does not cause a recursive rebuild.
        \Drupal::service('router.route_provider')->getAllRoutes();
    } catch (\RuntimeException $e) {
        $message = 'failed';
    }
    \Drupal::state()->set(__FUNCTION__, $message);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.