Skip to content

Commit

Permalink
LatteExtension: added option 'strictTypes'
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 25, 2017
1 parent 804688d commit fa341fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Bridges/ApplicationDI/LatteExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LatteExtension extends Nette\DI\CompilerExtension
'xhtml' => FALSE,
'macros' => [],
'templateClass' => NULL,
'strictTypes' => FALSE,
];

/** @var bool */
Expand All @@ -47,14 +48,18 @@ public function loadConfiguration()
$config = $this->validateConfig($this->defaults);
$builder = $this->getContainerBuilder();

$builder->addDefinition($this->prefix('latteFactory'))
$latteFactory = $builder->addDefinition($this->prefix('latteFactory'))
->setClass(Latte\Engine::class)
->addSetup('setTempDirectory', [$this->tempDir])
->addSetup('setAutoRefresh', [$this->debugMode])
->addSetup('setContentType', [$config['xhtml'] ? Latte\Compiler::CONTENT_XHTML : Latte\Compiler::CONTENT_HTML])
->addSetup('Nette\Utils\Html::$xhtml = ?', [(bool) $config['xhtml']])
->setImplement(Nette\Bridges\ApplicationLatte\ILatteFactory::class);

if ($config['strictTypes']) {
$latteFactory->addSetup('setStrictTypes', [TRUE]);
}

$builder->addDefinition($this->prefix('templateFactory'))
->setClass(Nette\Application\UI\ITemplateFactory::class)
->setFactory(Nette\Bridges\ApplicationLatte\TemplateFactory::class)
Expand Down

0 comments on commit fa341fd

Please sign in to comment.