mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-08-25 15:01:16 +02:00
Minor optimizations to TwigFactory
This commit is contained in:
@@ -40,24 +40,18 @@ class TwigFactory
|
||||
{
|
||||
$twig = new Twig(new FilesystemLoader(
|
||||
$this->container->get('views_path')
|
||||
));
|
||||
), ['cache' => $this->container->get('view_cache')]);
|
||||
|
||||
$twig->getEnvironment()->setCache(
|
||||
$this->container->get('view_cache')
|
||||
);
|
||||
$environment = $twig->getEnvironment();
|
||||
$core = $environment->getExtension(CoreExtension::class);
|
||||
|
||||
$twig->getEnvironment()->getExtension(CoreExtension::class)->setDateFormat(
|
||||
$this->container->get('date_format'), '%d days'
|
||||
);
|
||||
|
||||
$twig->getEnvironment()->getExtension(CoreExtension::class)->setTimezone(
|
||||
$this->container->get('timezone')
|
||||
);
|
||||
$core->setDateFormat($this->container->get('date_format'), '%d days');
|
||||
$core->setTimezone($this->container->get('timezone'));
|
||||
|
||||
foreach ($this->container->get('view_functions') as $function) {
|
||||
$function = $this->callableResolver->resolve($function);
|
||||
|
||||
$twig->getEnvironment()->addFunction(
|
||||
$environment->addFunction(
|
||||
new TwigFunction($function->name(), $function)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user