You are here

protected function RouteSubscriber::alterRoutes in Theme permission 2.0.x

Same name and namespace in other branches
  1. 8 src/Routing/RouteSubscriber.php \Drupal\theme_permission\Routing\RouteSubscriber::alterRoutes()

Plugin annotation

@SuppressWarnings(PHPMD);

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 20

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\theme_permission\Routing

Code

protected function alterRoutes(RouteCollection $collection) : void {
  if ($route = $collection
    ->get('block.admin_display_theme')) {
    $route
      ->setRequirement('_custom_access', '\\Drupal\\theme_permission\\Controller\\AccessController::access');
  }
  if ($route = $collection
    ->get('system.theme_settings_theme')) {
    $route
      ->setRequirement('_custom_access', '\\Drupal\\theme_permission\\Controller\\AccessController::access');
  }
  if ($route = $collection
    ->get('system.theme_set_default')) {
    $route
      ->setRequirement('_custom_access', '\\Drupal\\theme_permission\\Controller\\AccessController::access');
  }
  if ($route = $collection
    ->get('system.theme_install')) {
    $route
      ->setRequirement('_custom_access', '\\Drupal\\theme_permission\\Controller\\AccessController::access');
  }
  if ($route = $collection
    ->get('system.theme_uninstall')) {
    $route
      ->setRequirement('_custom_access', '\\Drupal\\theme_permission\\Controller\\AccessController::access');
  }
  if ($route = $collection
    ->get('system.themes_page')) {
    $route
      ->setDefaults([
      '_controller' => '\\Drupal\\theme_permission\\Controller\\AccessController::themesPage',
    ]);
  }
}