protected function Date::opSimple in Zircon Profile 8.0
Same name in this branch
- 8.0 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opSimple()
- 8.0 core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opSimple()
Same name and namespace in other branches
- 8 core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opSimple()
Override parent method, which deals with dates as integers.
Overrides Date::opSimple
File
- core/
modules/ datetime/ src/ Plugin/ views/ filter/ Date.php, line 119 - Contains \Drupal\datetime\Plugin\views\filter\Date.
Class
- Date
- Date/time views filter.
Namespace
Drupal\datetime\Plugin\views\filterCode
protected function opSimple($field) {
$origin = !empty($this->value['type']) && $this->value['type'] == 'offset' ? $this->requestStack
->getCurrentRequest()->server
->get('REQUEST_TIME') : 0;
$value = intval(strtotime($this->value['value'], $origin));
// Convert to ISO. UTC is used since dates are stored in UTC.
$value = $this->query
->getDateFormat("'" . $this->dateFormatter
->format($value, 'custom', DATETIME_DATETIME_STORAGE_FORMAT, DATETIME_STORAGE_TIMEZONE) . "'", $this->dateFormat, TRUE);
// This is safe because we are manually scrubbing the value.
$field = $this->query
->getDateFormat($field, $this->dateFormat, TRUE);
$this->query
->addWhereExpression($this->options['group'], "{$field} {$this->operator} {$value}");
}