You are here

public function StaticTest::alterRouteDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php \Drupal\views_test_data\Plugin\views\access\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

core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php, line 37

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');
  }
}