You are here

public function Role::alterRouteDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Plugin/views/access/Role.php \Drupal\user\Plugin\views\access\Role::alterRouteDefinition()

Allows access plugins to alter the route definition of a view.

Likely the access plugin will add new requirements, so its custom access checker can be applied.

Parameters

\Symfony\Component\Routing\Route $route: The route to change.

Overrides AccessPluginBase::alterRouteDefinition

File

core/modules/user/src/Plugin/views/access/Role.php, line 83
Contains \Drupal\user\Plugin\views\access\Role.

Class

Role
Access plugin that provides role-based access control.

Namespace

Drupal\user\Plugin\views\access

Code

public function alterRouteDefinition(Route $route) {
  if ($this->options['role']) {
    $route
      ->setRequirement('_role', (string) implode('+', $this->options['role']));
  }
}