DayDate.php in Views XML Backend 8
File
src/Plugin/views/argument/DayDate.php
View source
<?php
namespace Drupal\views_xml_backend\Plugin\views\argument;
use Drupal\views_xml_backend\Xpath;
class DayDate extends Date {
protected $format = 'j';
protected $argFormat = 'd';
public function summaryName($data) {
$day = str_pad($data->{$this->name_alias}, 2, '0', STR_PAD_LEFT);
return format_date(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
}
public function title() {
$day = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
return format_date(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
}
public function summaryArgument($data) {
return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
}
public function __toString() {
$xpath = $this->options['xpath_selector'];
$value = Xpath::escapeXpathString(str_pad((int) $this
->getValue(), 2, '0', STR_PAD_LEFT));
$format = Xpath::escapeXpathString($this->argFormat);
return "php:functionString('views_xml_backend_format_value', {$xpath}, {$format}) = {$value}";
}
}
Classes
Name |
Description |
DayDate |
Argument handler for a day (DD). |