You are here

protected function Date::opSimple in CiviCRM Entity 8.3

Overrides Date::opSimple

File

src/Plugin/views/filter/Date.php, line 79

Class

Date
An "In" handler to include CiviCRM API.

Namespace

Drupal\civicrm_entity\Plugin\views\filter

Code

protected function opSimple($field) {
  $value = intval(strtotime($this->value['value'], 0));
  if (!empty($this->value['type']) && $this->value['type'] == 'offset') {
    $value = time() + sprintf('%+d', $value);
  }
  $value = DateTimePlus::createFromTimestamp($value);
  $value = $this->dateFormatter
    ->format($value
    ->getTimestamp(), 'custom', $this->dateFormat);
  $value = $this
    ->getFieldDateFormat("'" . $value . "'");
  $field = $this
    ->getFieldDateFormat($field);
  $this->query
    ->addWhereExpression($this->options['group'], "{$field} {$this->operator} {$value}");
}