public function StaticTest::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

drupal/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/access/StaticTest.php, line 41
Definition of Drupal\views_test_data\Plugin\views\access\StaticTest.

Class

StaticTest
Tests a static access plugin.

Namespace

Drupal\views_test_data\Plugin\views\access

Code

public function alterRouteDefinition(Route $route) {
  if (!empty($this->options['access'])) {
    $route
      ->setRequirement('_access', 'TRUE');
  }
}