You are here

public function DomainAccessContent::alterRouteDefinition in Domain Access 8

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

2 calls to DomainAccessContent::alterRouteDefinition()
DomainContentAccess::alterRouteDefinition in domain_content/src/Plugin/views/access/DomainContentAccess.php
Allows access plugins to alter the route definition of a view.
DomainEditorAccess::alterRouteDefinition in domain_content/src/Plugin/views/access/DomainEditorAccess.php
Allows access plugins to alter the route definition of a view.
2 methods override DomainAccessContent::alterRouteDefinition()
DomainContentAccess::alterRouteDefinition in domain_content/src/Plugin/views/access/DomainContentAccess.php
Allows access plugins to alter the route definition of a view.
DomainEditorAccess::alterRouteDefinition in domain_content/src/Plugin/views/access/DomainEditorAccess.php
Allows access plugins to alter the route definition of a view.

File

domain_access/src/Plugin/views/access/DomainAccessContent.php, line 139

Class

DomainAccessContent
Access plugin that provides domain-editing access control.

Namespace

Drupal\domain_access\Plugin\views\access

Code

public function alterRouteDefinition(Route $route) {
  if ($domains = $this->domainStorage
    ->loadMultiple()) {
    $list = array_keys($domains);
  }
  $list[] = 'all_affiliates';
  $route
    ->setRequirement('_domain_access_views', (string) implode('+', $list));
  $route
    ->setDefault('domain_permission', $this->permission);
  $route
    ->setDefault('domain_all_permission', $this->allPermission);
}