function 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\filter

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.