You are here

public function TempStore::getArgument 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::getArgument()

Return the default argument.

This needs to be overridden by every default argument handler to properly do what is needed.

Overrides ArgumentDefaultPluginBase::getArgument

File

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

Class

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

Namespace

Drupal\views_extras\Plugin\views\argument_default

Code

public function getArgument() {
  if (!empty($key = $this->options['tempStore_key'])) {
    return $this->tempStoreFactory
      ->get($this->options['tempStore_unique_name'])
      ->get($this->options['tempStore_key']);
  }
  elseif (!empty($value = $this->options['fallback_value'])) {
    return $this->token
      ->replace($value, [
      'user' => $this->currentUser,
    ]);
  }
}