public function CalendarValidator::buildOptionsForm in Calendar 8
Same name and namespace in other branches
- 8.2 src/Plugin/views/argument_validator/CalendarValidator.php \Drupal\calendar\Plugin\views\argument_validator\CalendarValidator::buildOptionsForm()
Provides the default form for setting options.
Overrides ArgumentValidatorPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ argument_validator/ CalendarValidator.php, line 125
Class
- CalendarValidator
- Defines a argument validator plugin for Date arguments used in Calendar.
Namespace
Drupal\calendar\Plugin\views\argument_validatorCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
if (!isset($this->argumentWrapper)) {
return;
}
// We can't set default in defineOptions because argument is not set yet.
if ($this->options['replacement_format']) {
$default = $this->options['replacement_format'];
}
else {
$default = $this
->getDefaultReplacementFormat();
}
$form['replacement_format'] = [
'#type' => 'textfield',
'#title' => $this
->t('Replacement date pattern'),
'#default_value' => $default,
// @todo Better description and link
'#description' => $this
->t('Provide a date pattern to be used when replace this arguments as a title.'),
];
}