Display meta-fields in datatables (#1116)

This commit is contained in:
Kevin Papst
2019-09-19 20:28:31 +02:00
committed by GitHub
parent 24cbe3d281
commit 5aa422dde1
71 changed files with 1461 additions and 212 deletions

View File

@@ -80,41 +80,53 @@ class DateExtensions extends AbstractExtension
}
/**
* @param DateTime $date
* @param DateTime|string $date
* @return string
*/
public function dateShort(DateTime $date)
public function dateShort($date)
{
if (null === $this->dateFormat) {
$this->dateFormat = $this->localeSettings->getDateFormat();
}
if (!$date instanceof DateTime) {
$date = new DateTime($date);
}
return date_format($date, $this->dateFormat);
}
/**
* @param DateTime $date
* @param DateTime|string $date
* @return string
*/
public function dateTime(DateTime $date)
public function dateTime($date)
{
if (null === $this->dateTimeFormat) {
$this->dateTimeFormat = $this->localeSettings->getDateTimeFormat();
}
if (!$date instanceof DateTime) {
$date = new DateTime($date);
}
return date_format($date, $this->dateTimeFormat);
}
/**
* @param DateTime $date
* @param DateTime|string $date
* @return string
*/
public function dateTimeFull(DateTime $date)
public function dateTimeFull($date)
{
if (null === $this->dateTimeTypeFormat) {
$this->dateTimeTypeFormat = $this->localeSettings->getDateTimeTypeFormat();
}
if (!$date instanceof DateTime) {
$date = new DateTime($date);
}
$formatter = new \IntlDateFormatter(
$this->localeSettings->getLocale(),
\IntlDateFormatter::MEDIUM,
@@ -128,25 +140,33 @@ class DateExtensions extends AbstractExtension
}
/**
* @param DateTime $date
* @param DateTime|string $date
* @param string $format
* @return false|string
*/
public function dateFormat(DateTime $date, string $format)
public function dateFormat($date, string $format)
{
if (!$date instanceof DateTime) {
$date = new DateTime($date);
}
return date_format($date, $format);
}
/**
* @param DateTime $date
* @param DateTime|string $date
* @return string
*/
public function time(DateTime $date)
public function time($date)
{
if (null === $this->timeFormat) {
$this->timeFormat = $this->localeSettings->getTimeFormat();
}
if (!$date instanceof DateTime) {
$date = new DateTime($date);
}
return date_format($date, $this->timeFormat);
}