public function GroupPermission::alterRouteDefinition in Group 8
Same name and namespace in other branches
- 2.0.x src/Plugin/views/access/GroupPermission.php \Drupal\group\Plugin\views\access\GroupPermission::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
- src/
Plugin/ views/ access/ GroupPermission.php, line 115
Class
- GroupPermission
- Access plugin that provides group permission-based access control.
Namespace
Drupal\group\Plugin\views\accessCode
public function alterRouteDefinition(Route $route) {
$route
->setRequirement('_group_permission', $this->options['group_permission']);
// Upcast any %group path key the user may have configured so the
// '_group_permission' access check will receive a properly loaded group.
$route
->setOption('parameters', [
'group' => [
'type' => 'entity:group',
],
]);
}