Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / views / src / Plugin / views / argument_default / Fixed.php
1 <?php
2
3 namespace Drupal\views\Plugin\views\argument_default;
4
5 use Drupal\Core\Cache\Cache;
6 use Drupal\Core\Cache\CacheableDependencyInterface;
7 use Drupal\Core\Form\FormStateInterface;
8
9 /**
10  * The fixed argument default handler.
11  *
12  * @ingroup views_argument_default_plugins
13  *
14  * @ViewsArgumentDefault(
15  *   id = "fixed",
16  *   title = @Translation("Fixed")
17  * )
18  */
19 class Fixed extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function defineOptions() {
25     $options = parent::defineOptions();
26     $options['argument'] = ['default' => ''];
27
28     return $options;
29   }
30
31   /**
32    * {@inheritdoc}
33    */
34   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
35     parent::buildOptionsForm($form, $form_state);
36     $form['argument'] = [
37       '#type' => 'textfield',
38       '#title' => $this->t('Fixed value'),
39       '#default_value' => $this->options['argument'],
40     ];
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function getArgument() {
47     return $this->options['argument'];
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   public function getCacheMaxAge() {
54     return Cache::PERMANENT;
55   }
56
57   /**
58    * {@inheritdoc}
59    */
60   public function getCacheContexts() {
61     return [];
62   }
63
64 }