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