protected function Date::hasValidGroupedValue in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::hasValidGroupedValue()
Determines if the given grouped filter entry has a valid value.
Parameters
array $group: A group entry as defined by buildGroupForm().
Return value
bool
Overrides FilterPluginBase::hasValidGroupedValue
File
- core/
modules/ views/ src/ Plugin/ views/ filter/ Date.php, line 103
Class
- Date
- Filter to handle dates stored as a timestamp.
Namespace
Drupal\views\Plugin\views\filterCode
protected function hasValidGroupedValue(array $group) {
if (!is_array($group['value']) || empty($group['value'])) {
return FALSE;
}
// Special case when validating grouped date filters because the
// $group['value'] array contains the type of filter (date or offset) and
// therefore the number of items the comparison has to be done against is
// one greater.
$operators = $this
->operators();
$expected = $operators[$group['operator']]['values'] + 1;
$actual = count(array_filter($group['value'], 'static::arrayFilterZero'));
return $actual == $expected;
}