class Fixed

Same name and namespace in other branches
  1. 11.x 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

Expanded class hierarchy of Fixed

Related topics

53 string references to 'Fixed'
ArgumentPluginBase::defineOptions in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
ViewElementTest::testViewElement in core/modules/views/tests/src/Functional/ViewElementTest.php
Tests the rendered output and form output of a view element.
ViewElementTest::testViewElement in core/modules/views/tests/src/Kernel/ViewElementTest.php
Tests the rendered output and form output of a view element.
ViewElementTest::testViewElementEmbed in core/modules/views/tests/src/Kernel/ViewElementTest.php
Tests the rendered output and form output of the "embed" display plugin.
ViewElementTest::testViewElementEmbed in core/modules/views/tests/src/Functional/ViewElementTest.php
Tests the rendered output and form output of the "embed" display plugin.

... See full list

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 [];
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.