Date.php in CiviCRM Entity 8.3
File
src/Plugin/views/argument/Date.php
View source
<?php
namespace Drupal\civicrm_entity\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\Date as BaseDate;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Routing\RouteMatchInterface;
class Date extends BaseDate {
public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $route_match, DateFormatterInterface $date_formatter) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $route_match, $date_formatter);
$this->argFormat = 'Y-m-d h:i:s';
}
public function getDateFormat($format) {
return $this->query
->getDateFormat($this
->getDateField(), $format);
}
public function getDateField() {
return $this->query
->getDateField("{$this->tableAlias}.{$this->realField}", TRUE, FALSE);
}
public function query($group_by = FALSE) {
$this
->ensureMyTable();
$value = $this->query
->getDateFormat($this->query
->getDateField("'" . $this->argument . "'", TRUE, FALSE), $this->argFormat);
$this->query
->addWhereExpression(0, "{$this->getFormula()} = {$value}");
}
}
Classes
Name |
Description |
Date |
Argument handler for CiviCRM dates. |