public function Role::alterRouteDefinition in Drupal 9
Same name and namespace in other branches
- 8 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 78
Class
- Role
- Access plugin that provides role-based access control.
Namespace
Drupal\user\Plugin\views\accessCode
public function alterRouteDefinition(Route $route) {
if ($this->options['role']) {
$route
->setRequirement('_role', (string) implode('+', $this->options['role']));
}
}