File tree Expand file tree Collapse file tree 2 files changed +16
-17
lines changed
src/Bridges/ApplicationLatte Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -60,13 +60,7 @@ public function initialize()
60
60
*/
61
61
public function finalize ()
62
62
{
63
- return [
64
- 'Nette\Bridges\ApplicationLatte\UIRuntime::initialize($this) ' ,
65
- '' ,
66
- $ this ->extends ? '' : '$this->parentName = $this->parentName ?: ($this->blocks && !$this->getReferringTemplate()
67
- && isset($this->global->uiControl) && $this->global->uiControl instanceof Nette\Application\UI\Presenter
68
- ? $this->global->uiControl->findLayoutTemplateFile() : NULL); ' ,
69
- ];
63
+ return [$ this ->extends . 'Nette\Bridges\ApplicationLatte\UIRuntime::initialize($this, $this->parentName, $this->blocks); ' ];
70
64
}
71
65
72
66
@@ -146,11 +140,10 @@ public function macroIfCurrent(MacroNode $node, PhpWriter $writer)
146
140
*/
147
141
public function macroExtends (MacroNode $ node , PhpWriter $ writer )
148
142
{
149
- $ this ->extends = TRUE ;
150
143
if ($ node ->modifiers || $ node ->parentNode || $ node ->args !== 'auto ' ) {
151
- return FALSE ;
144
+ return $ this -> extends = FALSE ;
152
145
}
153
- return $ writer ->write ('$this->parentName = $this->global->uiPresenter->findLayoutTemplateFile(); ' );
146
+ $ this -> extends = $ writer ->write ('$this->parentName = $this->global->uiPresenter->findLayoutTemplateFile(); ' );
154
147
}
155
148
156
149
Original file line number Diff line number Diff line change 8
8
namespace Nette \Bridges \ApplicationLatte ;
9
9
10
10
use Nette ;
11
- use Nette \Application \UI ;
12
11
use Latte ;
13
12
14
13
@@ -21,19 +20,26 @@ class UIRuntime
21
20
use Nette \StaticClass;
22
21
23
22
/**
24
- * @return bool
23
+ * @return void
25
24
*/
26
- public static function initialize (Latte \Runtime \Template $ template )
25
+ public static function initialize (Latte \Runtime \Template $ template, & $ parentName , array $ blocks )
27
26
{
27
+ $ providers = $ template ->global ;
28
+ if (!$ parentName && $ blocks && !$ template ->getReferringTemplate ()
29
+ && isset ($ providers ->uiControl ) && $ providers ->uiControl instanceof Nette \Application \UI \Presenter
30
+ ) {
31
+ $ parentName = $ providers ->uiControl ->findLayoutTemplateFile ();
32
+ }
33
+
28
34
// back compatiblity
29
35
$ params = $ template ->getParameters ();
30
- if (empty ($ template -> global ->uiControl ) && isset ($ params ['_control ' ])) {
36
+ if (empty ($ providers ->uiControl ) && isset ($ params ['_control ' ])) {
31
37
trigger_error ('Replace template variable $_control with provider: $latte->addProvider("uiControl", ...) ' , E_USER_DEPRECATED );
32
- $ template -> global ->uiControl = $ params ['_control ' ];
38
+ $ providers ->uiControl = $ params ['_control ' ];
33
39
}
34
- if (empty ($ template -> global ->uiPresenter ) && isset ($ params ['_presenter ' ])) {
40
+ if (empty ($ providers ->uiPresenter ) && isset ($ params ['_presenter ' ])) {
35
41
trigger_error ('Replace template variable $_presenter with provider: $latte->addProvider("uiPresenter", ...) ' , E_USER_DEPRECATED );
36
- $ template -> global ->uiPresenter = $ params ['_presenter ' ];
42
+ $ providers ->uiPresenter = $ params ['_presenter ' ];
37
43
}
38
44
}
39
45
You can’t perform that action at this time.
0 commit comments