You are here

protected function DisableThemeCsrfRouteSubscriber::alterRoutes in Automatic Updates 8

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

tests/modules/test_automatic_updates/src/EventSubscriber/DisableThemeCsrfRouteSubscriber.php, line 16

Class

DisableThemeCsrfRouteSubscriber
Disable theme CSRF route subscriber.

Namespace

Drupal\test_automatic_updates\EventSubscriber

Code

protected function alterRoutes(RouteCollection $collection) {

  // Disable CSRF so we can easily enable themes in tests.
  if ($route = $collection
    ->get('system.theme_set_default')) {
    $route
      ->setRequirements([
      '_permission' => 'administer themes',
    ]);
  }
}