You are here

class Fixed in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/argument_default/Fixed.php \Drupal\views\Plugin\views\argument_default\Fixed
  2. 9 core/modules/views/src/Plugin/views/argument_default/Fixed.php \Drupal\views\Plugin\views\argument_default\Fixed

The fixed argument default handler.

Plugin annotation


@ViewsArgumentDefault(
  id = "fixed",
  title = @Translation("Fixed")
)

Hierarchy

  • class \Drupal\views\Plugin\views\argument_default\Fixed extends \Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase implements CacheableDependencyInterface

Expanded class hierarchy of Fixed

1 string reference to 'Fixed'
views.argument_default.schema.yml in core/modules/views/config/schema/views.argument_default.schema.yml
core/modules/views/config/schema/views.argument_default.schema.yml

File

core/modules/views/src/Plugin/views/argument_default/Fixed.php, line 19

Namespace

Drupal\views\Plugin\views\argument_default
View source
class Fixed extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {

  /**
   * {@inheritdoc}
   */
  protected function defineOptions() {
    $options = parent::defineOptions();
    $options['argument'] = [
      'default' => '',
    ];
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  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'],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getArgument() {
    return $this->options['argument'];
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return Cache::PERMANENT;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 17
Fixed::buildOptionsForm public function
Fixed::defineOptions protected function
Fixed::getArgument public function
Fixed::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
Fixed::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge