Author: Fabien Potencier (fabien.potencier@symfony-project.com)
Inheritance: extends Symfony\Component\Templating\Loader\Loader
 public function register(Container $app)
 {
     $app['templating.name_parser'] = function () {
         return new TemplateNameParser();
     };
     $app['templating.loader'] = function (Container $app) {
         $loader = new FilesystemLoader($app['templating.paths']);
         if (isset($app['logger'])) {
             $loader->setLogger($app['logger']);
         }
         return $loader;
     };
     $app['templating'] = function (Container $app) {
         $engines = [new PhpEngine($app['templating.name_parser'], $app['templating.loader'])];
         if (isset($app['twig']) && class_exists('Symfony\\Bridge\\Twig\\TwigEngine')) {
             $engines[] = new TwigEngine($app['twig'], $app['templating.name_parser']);
         }
         return new DelegatingEngine($engines);
     };
     $app['templating.paths'] = [];
 }
Exemplo n.º 2
0
 public function load(TemplateReferenceInterface $template)
 {
     $file = $template->get('name');
     foreach ($this->paths as $path) {
         $template->set('name', $path . '/' . $file);
         $result = parent::load($template);
         if ($result) {
             return $result;
         }
     }
     return false;
 }
Exemplo n.º 3
0
 public static function isAbsolutePath($path)
 {
     return parent::isAbsolutePath($path);
 }
Exemplo n.º 4
0
 /**
  * @param \Symfony\Component\Templating\TemplateReferenceInterface $template
  * @return bool|\Symfony\Component\Templating\Loader\Storage|\Symfony\Component\Templating\Storage\Storage
  */
 public function load(TemplateReferenceInterface $template)
 {
     $filename = $this->locator->locate($template);
     $template->set('name', $filename);
     return parent::load($template);
 }