function LazyRouteProviderInstallTestHooks::menuLinksDiscoveredAlter

Implements hook_menu_links_discovered_alter().

File

core/modules/system/tests/modules/lazy_route_provider_install_test/src/Hook/LazyRouteProviderInstallTestHooks.php, line 17

Class

LazyRouteProviderInstallTestHooks
Hook implementations for lazy_route_provider_install_test.

Namespace

Drupal\lazy_route_provider_install_test\Hook

Code

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

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