enhanced plugin support (#634)
- refactored admin controller and templates - plugin support for entity actions - changed column mail to email in customer table - refactored theme events
This commit is contained in:
@@ -11,12 +11,13 @@ namespace App\Twig;
|
||||
|
||||
use App\Utils\LocaleSettings;
|
||||
use DateTime;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
|
||||
/**
|
||||
* Date specific twig extensions
|
||||
*/
|
||||
class DateExtensions extends \Twig_Extension
|
||||
class DateExtensions extends AbstractExtension
|
||||
{
|
||||
/**
|
||||
* @var LocaleSettings|null
|
||||
@@ -30,6 +31,10 @@ class DateExtensions extends \Twig_Extension
|
||||
* @var string
|
||||
*/
|
||||
protected $dateTimeFormat = null;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $dateTimeTypeFormat = null;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@@ -56,6 +61,7 @@ class DateExtensions extends \Twig_Extension
|
||||
new TwigFilter('month_name', [$this, 'monthName']),
|
||||
new TwigFilter('date_short', [$this, 'dateShort']),
|
||||
new TwigFilter('date_time', [$this, 'dateTime']),
|
||||
new TwigFilter('date_full', [$this, 'dateTimeFull']),
|
||||
new TwigFilter('date_format', [$this, 'dateFormat']),
|
||||
new TwigFilter('time', [$this, 'time']),
|
||||
new TwigFilter('hour24', [$this, 'hour24']),
|
||||
@@ -88,6 +94,28 @@ class DateExtensions extends \Twig_Extension
|
||||
return date_format($date, $this->dateTimeFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DateTime $date
|
||||
* @return string
|
||||
*/
|
||||
public function dateTimeFull(DateTime $date)
|
||||
{
|
||||
if (null === $this->dateTimeTypeFormat) {
|
||||
$this->dateTimeTypeFormat = $this->localeSettings->getDateTimeTypeFormat();
|
||||
}
|
||||
|
||||
$formatter = new \IntlDateFormatter(
|
||||
$this->localeSettings->getLocale(),
|
||||
\IntlDateFormatter::MEDIUM,
|
||||
\IntlDateFormatter::MEDIUM,
|
||||
date_default_timezone_get(),
|
||||
\IntlDateFormatter::GREGORIAN,
|
||||
$this->dateTimeTypeFormat
|
||||
);
|
||||
|
||||
return $formatter->format($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DateTime $date
|
||||
* @param string $format
|
||||
|
||||
Reference in New Issue
Block a user