function MenuLinksetRoutes::alterRoutes

Same name in other branches
  1. 10 core/modules/system/src/Routing/MenuLinksetRoutes.php \Drupal\system\Routing\MenuLinksetRoutes::alterRoutes()

Alter routes.

If the endpoint is configured to be enabled, dynamically enable all authentication providers on this module's routes since they cannot be known in advance.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: A collection of routes.

Overrides RouteSubscriberBase::alterRoutes

File

core/modules/system/src/Routing/MenuLinksetRoutes.php, line 51

Class

MenuLinksetRoutes
Dynamically defines routes for menu linkset endpoints.

Namespace

Drupal\system\Routing

Code

public function alterRoutes(RouteCollection $collection) {
    if ($this->configFactory
        ->get('system.feature_flags')
        ->get('linkset_endpoint')) {
        $collection->get('system.menu.linkset')
            ->setOption('_auth', $this->providerIds);
    }
}

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