diff --git a/DependencyInjection/LexikTranslationExtension.php b/DependencyInjection/LexikTranslationExtension.php index 2a869ed8..3d573f30 100644 --- a/DependencyInjection/LexikTranslationExtension.php +++ b/DependencyInjection/LexikTranslationExtension.php @@ -138,9 +138,18 @@ public function prepend(ContainerBuilder $container) return; } + $rootDir = 'vendor/lexik/translation-bundle/Resources/views'; + + // Only symfony versions >= 3.3 include the kernel.project_dir parameter + if (Kernel::VERSION_ID >= 30300) { + $rootDir = '%kernel.project_dir%/'.$rootDir; + } else { + $rootDir = '%kernel.root_dir%/../'.$rootDir; + } + $container->prependExtensionConfig('twig', [ 'paths' => [ - '%kernel.project_dir%/vendor/lexik/translation-bundle/Resources/views' => 'LexikTranslationBundle' + $rootDir => 'LexikTranslationBundle' ] ]); }