You are here

public function TempStore::buildOptionsForm in Views Extras (Session/Cookie/Token Support) 8

Same name and namespace in other branches
  1. 2.x src/Plugin/views/argument_default/TempStore.php \Drupal\views_extras\Plugin\views\argument_default\TempStore::buildOptionsForm()

Provide the default form for setting options.

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

src/Plugin/views/argument_default/TempStore.php, line 110

Class

TempStore
Default argument plugin to use the raw value from the URL.

Namespace

Drupal\views_extras\Plugin\views\argument_default

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['tempStore_unique_name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Unique Name'),
    '#default_value' => $this->options['tempStore_unique_name'],
    '#description' => $this
      ->t('Unique namespace, used while setting the tempStore'),
  ];
  $form['tempStore_key'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('TempStore key'),
    '#default_value' => $this->options['tempStore_key'],
    '#description' => $this
      ->t('Keys of tempStore variable'),
  ];
  $form['fallback_value'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('If tempStore is not set, what should be the fallback value.'),
    '#default_value' => $this->options['fallback_value'],
    '#description' => $this
      ->t('You may use user tokens.'),
  ];
  if ($this->moduleHandler
    ->moduleExists("token")) {
    $form['token_help'] = [
      '#type' => 'markup',
      '#token_types' => [
        'user',
      ],
      '#theme' => 'token_tree_link',
    ];
  }
  $form['cache_time'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Cache Maximum Age.'),
    '#default_value' => $this->options['cache_time'],
    '#description' => $this
      ->t('If tempStore value changes set it to 0.'),
  ];
}