3 namespace Drupal\views_test_data\Plugin\views\access;
5 use Drupal\Core\Session\AccountInterface;
6 use Drupal\views\Plugin\views\access\AccessPluginBase;
7 use Symfony\Component\Routing\Route;
10 * Tests a static access plugin.
14 * title = @Translation("Static test access plugin"),
15 * help = @Translation("Provides a static test access plugin.")
18 class StaticTest extends AccessPluginBase {
20 protected function defineOptions() {
21 $options = parent::defineOptions();
22 $options['access'] = ['default' => FALSE];
30 public function access(AccountInterface $account) {
31 return !empty($this->options['access']);
37 public function alterRouteDefinition(Route $route) {
38 if (!empty($this->options['access'])) {
39 $route->setRequirement('_access', 'TRUE');
46 public function calculateDependencies() {
48 'content' => ['StaticTest'],