@@ -24,9 +24,6 @@ class LatteExtension extends Nette\DI\CompilerExtension
24
24
'macros ' => array (),
25
25
);
26
26
27
- /** @var bool */
28
- private $ xhtml ;
29
-
30
27
/** @var bool */
31
28
private $ debugMode ;
32
29
@@ -61,14 +58,14 @@ public function loadConfiguration()
61
58
}
62
59
63
60
$ this ->validate ($ config , $ this ->defaults , $ this ->name );
64
- $ this ->xhtml = $ config ['xhtml ' ];
65
61
$ container = $ this ->getContainerBuilder ();
66
62
67
63
$ latteFactory = $ container ->addDefinition ('nette.latteFactory ' )
68
64
->setClass ('Latte\Engine ' )
69
65
->addSetup ('setTempDirectory ' , array ($ this ->tempDir ))
70
66
->addSetup ('setAutoRefresh ' , array ($ this ->debugMode ))
71
67
->addSetup ('setContentType ' , array ($ config ['xhtml ' ] ? Latte \Compiler::CONTENT_XHTML : Latte \Compiler::CONTENT_HTML ))
68
+ ->addSetup ('Nette\Utils\Html::$xhtml = ?; ' , array ((bool ) $ config ['xhtml ' ]))
72
69
->setImplement ('Nette\Bridges\ApplicationLatte\ILatteFactory ' );
73
70
74
71
$ container ->addDefinition ('nette.templateFactory ' )
@@ -81,6 +78,7 @@ public function loadConfiguration()
81
78
->addSetup ('setTempDirectory ' , array ($ this ->tempDir ))
82
79
->addSetup ('setAutoRefresh ' , array ($ this ->debugMode ))
83
80
->addSetup ('setContentType ' , array ($ config ['xhtml ' ] ? Latte \Compiler::CONTENT_XHTML : Latte \Compiler::CONTENT_HTML ))
81
+ ->addSetup ('Nette\Utils\Html::$xhtml = ?; ' , array ((bool ) $ config ['xhtml ' ]))
84
82
->setAutowired (FALSE );
85
83
86
84
foreach ($ config ['macros ' ] as $ macro ) {
@@ -101,14 +99,6 @@ public function loadConfiguration()
101
99
}
102
100
103
101
104
- public function afterCompile (Nette \PhpGenerator \ClassType $ class )
105
- {
106
- if ($ this ->xhtml ) {
107
- $ class ->methods ['initialize ' ]->addBody ('Nette\Utils\Html::$xhtml = TRUE; ' );
108
- }
109
- }
110
-
111
-
112
102
/**
113
103
* @param callable
114
104
* @return void
0 commit comments