Date.php in EntityFieldQuery Views Backend 8
File
src/Plugin/views/filter/Date.php
View source
<?php
namespace Drupal\efq_views\Plugin\views\filter;
use Drupal\views\Plugin\views\filter\Date as ViewsDate;
use Drupal\Core\Form\FormStateInterface;
class Date extends ViewsDate {
protected function valueForm(&$form, FormStateInterface $form_state) {
parent::valueForm($form, $form_state);
unset($form['value']['type']);
$form['value']['value']['#description'] = t('A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.');
}
public function query() {
$info = $this
->operators();
if (!empty($info[$this->operator]['method'])) {
$this
->{$info[$this->operator]['method']}($this->real_field);
}
}
protected function opBetween($field) {
if ($this->operator == 'between') {
$a = strtotime($this->value['min']);
$b = strtotime($this->value['max']);
}
else {
$a = strtotime($this->value['max']);
$b = strtotime($this->value['min']);
}
return array(
$a,
$b,
);
}
protected function opSimple($field) {
return strtotime($this->value['value']);
}
}
Classes
Name |
Description |
Date |
Filter handler for date properties. |