public function Session::buildOptionsForm in Views Extras (Session/Cookie/Token Support) 8
Same name and namespace in other branches
- 2.x src/Plugin/views/argument_default/Session.php \Drupal\views_extras\Plugin\views\argument_default\Session::buildOptionsForm()
Provide the default form for setting options.
Overrides ArgumentDefaultPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ argument_default/ Session.php, line 98
Class
- Session
- 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['session_key'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Session variable key'),
'#default_value' => $this->options['session_key'],
'#description' => $this
->t('Keys of SESSION variable seperated by ::, e.g. for $_SESSION["key1"]["key2"], the key would be "key1::key2".'),
);
$form['fallback_value'] = array(
'#type' => 'textfield',
'#title' => $this
->t('If session 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'] = array(
'#type' => 'markup',
'#token_types' => array(
'user',
),
'#theme' => 'token_tree_link',
);
}
$form['cache_time'] = array(
'#type' => 'number',
'#title' => $this
->t('Cache Maximum Age.'),
'#default_value' => $this->options['cache_time'],
'#description' => $this
->t('If session variable changes in between session set it to 0.'),
);
}