public function DateRange::buildOptionsForm in Views Contextual Range Filter 8
Build the options form.
Overrides ArgumentPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ argument/ DateRange.php, line 94
Class
- DateRange
- Argument handler to accept a date range.
Namespace
Drupal\contextual_range_filter\Plugin\views\argumentCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['description']['#markup'] = t('Contextual date range filter values are taken from the URL.');
$form['more']['#open'] = TRUE;
$form['relative_dates'] = [
'#type' => 'checkbox',
'#title' => t('Allow relative date ranges'),
'#description' => t('If ticked, offsets from the current date may be specified.<br/>Example: <strong>2 weeks ago--yesterday"</strong>'),
'#default_value' => $this->options['relative_dates'],
'#group' => 'options][more',
];
// Allow passing multiple values.
$form['break_phrase'] = [
'#type' => 'checkbox',
'#title' => t('Allow multiple date ranges'),
'#description' => t('If selected, multiple date ranges may be specified by stringing them together with plus signs.<br/>Example: <strong>19990101--20051231+20130701--20140630</strong>'),
'#default_value' => $this->options['break_phrase'],
'#group' => 'options][more',
];
$form['not'] = [
'#type' => 'checkbox',
'#title' => t('Exclude'),
'#description' => t('Negate the range. If selected, output matching the specified date range(s) will be excluded, rather than included.'),
'#default_value' => !empty($this->options['not']),
'#group' => 'options][more',
];
}