예제 #1
0
 private function buildTwig(TwigFactory $twigFactory, array $layouts)
 {
     $templates = $this->processLayouts($layouts);
     $includesDir = $this->contentLocator->getIncludesDir();
     $extraDirs = [];
     if ($includesDir) {
         $extraDirs[] = $includesDir;
     }
     $this->twig = $twigFactory->withAutoescape(false)->withCache(false)->addLoaderFilesystem($extraDirs)->addLoaderArray($templates)->addLoaderString()->create();
 }
예제 #2
0
 public function testCreateLoaderFilesystemNamespace()
 {
     $factory = new TwigFactory();
     $twig = $factory->withAutoescape(false)->withCache(false)->withDebug(false)->addLoaderString()->addLoaderFilesystem(array('myNamespace' => __DIR__))->create();
     $this->assertInstanceOf('Twig_Environment', $twig);
 }