Skip to content

Commit

Permalink
Deprecated Twig classes forkcms#2777
Browse files Browse the repository at this point in the history
  • Loading branch information
aalwash committed Apr 23, 2019
1 parent fe134d8 commit a68a4c8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Frontend/Core/Engine/TwigTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
use Symfony\Bridge\Twig\Extension\FormExtension as SymfonyFormExtension;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Templating\TemplateNameParserInterface;
use Twig_Environment;
use Twig_FactoryRuntimeLoader;
use Twig\Environment;
use Twig\Loader\ChainLoader;
use Twig\Loader\FilesystemLoader;
use Twig\RuntimeLoader\FactoryRuntimeLoader;

/**
* This is a twig template wrapper
Expand All @@ -26,7 +28,7 @@ class TwigTemplate extends BaseTwigTemplate
private $themePath;

public function __construct(
Twig_Environment $environment,
Environment $environment,
TemplateNameParserInterface $parser,
FileLocatorInterface $locator
) {
Expand Down Expand Up @@ -58,8 +60,8 @@ private function addFrontendPathsToTheTemplateLoader(string $theme): void
{
$this->themePath = FRONTEND_PATH . '/Themes/' . $theme;
$this->environment->setLoader(
new \Twig_Loader_Chain(
[$this->environment->getLoader(), new \Twig_Loader_Filesystem($this->getLoadingFolders())]
new ChainLoader(
[$this->environment->getLoader(), new FilesystemLoader($this->getLoadingFolders())]
)
);
}
Expand All @@ -69,7 +71,7 @@ private function connectSymfonyForms(): void
$rendererEngine = new TwigRendererEngine($this->getFormTemplates('FormLayout.html.twig'), $this->environment);
$csrfTokenManager = Model::get('security.csrf.token_manager');
$this->environment->addRuntimeLoader(
new Twig_FactoryRuntimeLoader(
new FactoryRuntimeLoader(
[
FormRenderer::class => function () use ($rendererEngine, $csrfTokenManager): FormRenderer {
return new FormRenderer($rendererEngine, $csrfTokenManager);
Expand Down

0 comments on commit a68a4c8

Please sign in to comment.