public function Cookie::buildOptionsForm in Views Extras (Session/Cookie/Token Support) 2.x
Same name and namespace in other branches
- 8 src/Plugin/views/argument_default/Cookie.php \Drupal\views_extras\Plugin\views\argument_default\Cookie::buildOptionsForm()
Provide the default form for setting options.
Overrides ArgumentDefaultPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ argument_default/ Cookie.php, line 99
Class
- Cookie
- Default argument plugin to use the raw value from the URL.
Namespace
Drupal\views_extras\Plugin\views\argument_defaultCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['cookie_key'] = [
'#type' => 'textfield',
'#title' => $this
->t('Cookie variable key'),
'#default_value' => $this->options['cookie_key'],
'#description' => $this
->t('Key of Cookie variable, e.g. for $_COOKIE["key"], the key would be "key".'),
];
$form['fallback_value'] = [
'#type' => 'textfield',
'#title' => $this
->t('If cookie variable 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',
];
}
}