You are here

class DisableThemeCsrfRouteSubscriber in Automatic Updates 8

Disable theme CSRF route subscriber.

Hierarchy

Expanded class hierarchy of DisableThemeCsrfRouteSubscriber

1 string reference to 'DisableThemeCsrfRouteSubscriber'
test_automatic_updates.services.yml in tests/modules/test_automatic_updates/test_automatic_updates.services.yml
tests/modules/test_automatic_updates/test_automatic_updates.services.yml
1 service uses DisableThemeCsrfRouteSubscriber
test_automatic_updates.route_subscriber in tests/modules/test_automatic_updates/test_automatic_updates.services.yml
Drupal\test_automatic_updates\EventSubscriber\DisableThemeCsrfRouteSubscriber

File

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

Namespace

Drupal\test_automatic_updates\EventSubscriber
View source
class DisableThemeCsrfRouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  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',
      ]);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DisableThemeCsrfRouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1