You are here

public function SearchApiDate::calculateRange in Facets 8

Calculate the range for a given facet filter value.

Used when adding active items in self::execute() to $this->query to include the range conditions for the value.

Parameters

string $value: The raw value for the facet filter.

Return value

array Keyed with 'start' and 'stop' values.

Overrides QueryTypeRangeBase::calculateRange

File

src/Plugin/facets/query_type/SearchApiDate.php, line 75

Class

SearchApiDate
Support for date facets within the Search API scope.

Namespace

Drupal\facets\Plugin\facets\query_type

Code

public function calculateRange($value) {
  if ($this
    ->getDateDisplay() === 'relative_date') {
    return $this
      ->calculateRangeRelative($value);
  }
  else {
    return $this
      ->calculateRangeAbsolute($value);
  }
}