61ef3279ace38b2a06adb607a9a78098cbc5fbf3
[yaffs-website] / web / core / modules / views / tests / modules / views_test_data / src / Plugin / views / argument_validator / ArgumentValidatorTest.php
1 <?php
2
3 namespace Drupal\views_test_data\Plugin\views\argument_validator;
4 use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
5
6 /**
7  * Defines a argument validator test plugin.
8  *
9  * @ViewsArgumentValidator(
10  *   id = "argument_validator_test",
11  *   title = @Translation("Argument validator test")
12  * )
13  */
14 class ArgumentValidatorTest extends ArgumentValidatorPluginBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function calculateDependencies() {
20     return [
21       'content' => ['ArgumentValidatorTest'],
22     ];
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   protected function defineOptions() {
29     $options = parent::defineOptions();
30     $options['test_value'] = ['default' => ''];
31
32     return $options;
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function validateArgument($arg) {
39     return $arg == $this->options['test_value'];
40   }
41
42 }