protected function HistoryUserTimestamp::valueForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php \Drupal\history\Plugin\views\filter\HistoryUserTimestamp::valueForm()
Options form subform for setting options.
This should be overridden by all child classes and it must define $form['value']
Overrides FilterPluginBase::valueForm
See also
buildOptionsForm()
File
- core/
modules/ history/ src/ Plugin/ views/ filter/ HistoryUserTimestamp.php, line 49
Class
- HistoryUserTimestamp
- Filter for new content.
Namespace
Drupal\history\Plugin\views\filterCode
protected function valueForm(&$form, FormStateInterface $form_state) {
// Only present a checkbox for the exposed filter itself. There's no way
// to tell the difference between not checked and the default value, so
// specifying the default value via the views UI is meaningless.
if ($form_state
->get('exposed')) {
if (isset($this->options['expose']['label'])) {
$label = $this->options['expose']['label'];
}
else {
$label = $this
->t('Has new content');
}
$form['value'] = [
'#type' => 'checkbox',
'#title' => $label,
'#default_value' => $this->value,
];
}
}