Revert "bug #14262 [TwigBundle] Refresh twig paths when resources change. (aitboudad)"
This reverts commit4d40852596
, reversing changes made todd2fb850a7
.
This commit is contained in:
parent
afd0b105a1
commit
a3ee1c5c09
@ -12,7 +12,6 @@
|
|||||||
namespace Symfony\Bundle\TwigBundle\DependencyInjection;
|
namespace Symfony\Bundle\TwigBundle\DependencyInjection;
|
||||||
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
@ -67,26 +66,22 @@ class TwigExtension extends Extension
|
|||||||
} else {
|
} else {
|
||||||
$twigFilesystemLoaderDefinition->addMethodCall('addPath', array($path, $namespace));
|
$twigFilesystemLoaderDefinition->addMethodCall('addPath', array($path, $namespace));
|
||||||
}
|
}
|
||||||
$container->addResource(new DirectoryResource($path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// register bundles as Twig namespaces
|
// register bundles as Twig namespaces
|
||||||
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
||||||
if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/'.$bundle.'/views')) {
|
if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/'.$bundle.'/views')) {
|
||||||
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
|
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
|
||||||
$container->addResource(new DirectoryResource($dir));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$reflection = new \ReflectionClass($class);
|
$reflection = new \ReflectionClass($class);
|
||||||
if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/views')) {
|
if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/views')) {
|
||||||
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
|
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
|
||||||
$container->addResource(new DirectoryResource($dir));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/views')) {
|
if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/views')) {
|
||||||
$twigFilesystemLoaderDefinition->addMethodCall('addPath', array($dir));
|
$twigFilesystemLoaderDefinition->addMethodCall('addPath', array($dir));
|
||||||
$container->addResource(new DirectoryResource($dir));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($config['globals'])) {
|
if (!empty($config['globals'])) {
|
||||||
|
Reference in New Issue
Block a user