LazyRouteProviderInstallTestHooks.php

Namespace

Drupal\lazy_route_provider_install_test\Hook

File

core/modules/system/tests/modules/lazy_route_provider_install_test/src/Hook/LazyRouteProviderInstallTestHooks.php

View source
<?php

declare (strict_types=1);
namespace Drupal\lazy_route_provider_install_test\Hook;

use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for lazy_route_provider_install_test.
 */
class LazyRouteProviderInstallTestHooks {
    
    /**
     * Implements hook_menu_links_discovered_alter().
     */
    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);
    }

}

Classes

Title Deprecated Summary
LazyRouteProviderInstallTestHooks Hook implementations for lazy_route_provider_install_test.

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