diff --git a/composer.json b/composer.json index 5dbb3f6..f4cdd0c 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "LGPL-3.0-or-later", "require": { "php": "^7.4 || ^8.0", - "contao/core-bundle": "^4.9", + "contao/core-bundle": "^4.13", "ext-json": "*", "symfony/cache": "^4.4||^5.4", "symfony/config": "^4.4||^5.4", diff --git a/config/services.yaml b/config/services.yaml index aa26d4c..703bdcf 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -14,8 +14,6 @@ services: HeimrichHannot\TwigSupportBundle\Cache\TemplateCache: ~ HeimrichHannot\TwigSupportBundle\Filesystem\TwigTemplateLocator: public: true - bind: - $finderFactory: '@contao.twig.finder_factory' HeimrichHannot\TwigSupportBundle\Helper\NormalizerHelper: ~ HeimrichHannot\TwigSupportBundle\Renderer\TwigTemplateRenderer: public: true diff --git a/src/Filesystem/TwigTemplateLocator.php b/src/Filesystem/TwigTemplateLocator.php index 419f7c9..fbe1a8c 100644 --- a/src/Filesystem/TwigTemplateLocator.php +++ b/src/Filesystem/TwigTemplateLocator.php @@ -11,7 +11,6 @@ use Contao\CoreBundle\Config\ResourceFinderInterface; use Contao\CoreBundle\Framework\ContaoFramework; use Contao\CoreBundle\Routing\ScopeMatcher; -use Contao\CoreBundle\Twig\Finder\FinderFactory; use Contao\CoreBundle\Twig\Loader\TemplateLocator; use Contao\PageModel; use Contao\ThemeModel; @@ -19,6 +18,7 @@ use HeimrichHannot\TwigSupportBundle\Cache\TemplateCache; use HeimrichHannot\TwigSupportBundle\Exception\TemplateNotFoundException; use Symfony\Component\Cache\Adapter\FilesystemAdapter; +use Symfony\Component\Filesystem\Path; use Symfony\Component\Finder\Exception\DirectoryNotFoundException; use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\SplFileInfo; @@ -26,8 +26,6 @@ use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Stopwatch\Stopwatch; -use Twig\Environment; -use Webmozart\PathUtil\Path; class TwigTemplateLocator { @@ -40,13 +38,8 @@ class TwigTemplateLocator protected Stopwatch $stopwatch; protected FilesystemAdapter $templateCache; private ContaoFramework $contaoFramework; - private Environment $twig; - private FinderFactory $finderFactory; private TemplateLocator $templateLocator; - /** @var array|string[] */ - private array $resourcePaths; - public function __construct( KernelInterface $kernel, ResourceFinderInterface $contaoResourceFinder, @@ -55,8 +48,6 @@ public function __construct( Stopwatch $stopwatch, FilesystemAdapter $templateCache, ContaoFramework $contaoFramework, - Environment $twig, - FinderFactory $finderFactory, TemplateLocator $templateLocator ) { @@ -67,8 +58,6 @@ public function __construct( $this->stopwatch = $stopwatch; $this->templateCache = $templateCache; $this->contaoFramework = $contaoFramework; - $this->twig = $twig; - $this->finderFactory = $finderFactory; $this->templateLocator = $templateLocator; } @@ -460,7 +449,6 @@ protected function generateContaoTwigTemplatePaths(bool $extension = false): arr } $twigFiles = []; - $projectDir = $this->kernel->getProjectDir(); foreach ($resourcePaths as $bundle => $paths) { foreach ($paths as $path) { $templates = $this->templateLocator->findTemplates($path);