You are here

protected function SearchApiDate::opSimple in Search API 8

Filters by a simple operator (=, !=, >, etc.).

Parameters

string $field: The views field.

Overrides Date::opSimple

File

src/Plugin/views/filter/SearchApiDate.php, line 112

Class

SearchApiDate
Defines a filter for filtering on dates.

Namespace

Drupal\search_api\Plugin\views\filter

Code

protected function opSimple($field) {
  $value = intval(strtotime($this->value['value'], 0));
  if (($this->value['type'] ?? '') == 'offset') {
    $time = $this
      ->getTimeService()
      ->getRequestTime();
    $value = strtotime($this->value['value'], $time);
  }
  $this
    ->getQuery()
    ->addCondition($this->realField, $value, $this->operator, $this->options['group']);
}