public function Cookie::getArgument in Views Extras (Session/Cookie/Token Support) 8
Same name and namespace in other branches
- 2.x src/Plugin/views/argument_default/Cookie.php \Drupal\views_extras\Plugin\views\argument_default\Cookie::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/ Cookie.php, line 125
Class
- Cookie
- Default argument plugin to use the raw value from the URL.
Namespace
Drupal\views_extras\Plugin\views\argument_defaultCode
public function getArgument() {
if (!empty($key = $this->options['cookie_key']) && !empty($_COOKIE['Drupal_visitor_' . $key])) {
return $_COOKIE['Drupal_visitor_' . $key];
}
if (!empty($value = $this->options['fallback_value'])) {
return $this->token
->replace($value, [
'user' => $this->current_user,
]);
}
return $value;
}