public function DateRecurFilter::validateExposed in Recurring Dates Field 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/views/filter/DateRecurFilter.php \Drupal\date_recur\Plugin\views\filter\DateRecurFilter::validateExposed()
- 3.0.x src/Plugin/views/filter/DateRecurFilter.php \Drupal\date_recur\Plugin\views\filter\DateRecurFilter::validateExposed()
- 3.1.x src/Plugin/views/filter/DateRecurFilter.php \Drupal\date_recur\Plugin\views\filter\DateRecurFilter::validateExposed()
Validate the exposed handler form.
Overrides HandlerBase::validateExposed
File
- src/
Plugin/ views/ filter/ DateRecurFilter.php, line 312
Class
- DateRecurFilter
- Date range/occurrence filter.
Namespace
Drupal\date_recur\Plugin\views\filterCode
public function validateExposed(&$form, FormStateInterface $form_state) : void {
if (empty($this->options['exposed'])) {
return;
}
if (empty($this->options['expose']['identifier'])) {
return;
}
$identifier = $this->options['expose']['identifier'];
if ($form_state
->isValueEmpty($identifier)) {
return;
}
$input = $form_state
->getValue($identifier);
// Check if element validator created errors.
$element = $form[$identifier];
if (!$form_state
->getError($element)) {
$granularity = $this->options['value_granularity'];
$timezone = new \DateTimeZone($element['#filter_plugin_user_timezone']);
$this->smallestDate = DateRecurUtility::createSmallestDateFromInput($granularity, $input, $timezone);
$this->largestDate = DateRecurUtility::createLargestDateFromInput($granularity, $input, $timezone);
}
}