Fixed.php in Drupal 9
File
core/modules/views/src/Plugin/views/argument_default/Fixed.php
View source
<?php
namespace Drupal\views\Plugin\views\argument_default;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface;
class Fixed extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
protected function defineOptions() {
$options = parent::defineOptions();
$options['argument'] = [
'default' => '',
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['argument'] = [
'#type' => 'textfield',
'#title' => $this
->t('Fixed value'),
'#default_value' => $this->options['argument'],
];
}
public function getArgument() {
return $this->options['argument'];
}
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
public function getCacheContexts() {
return [];
}
}
Classes
Name |
Description |
Fixed |
The fixed argument default handler. |