1: <?php
2:
3: 4: 5: 6:
7:
8: namespace Nette\Bridges\ApplicationLatte;
9:
10: use Latte;
11: use Nette;
12:
13:
14: 15: 16: 17:
18: class UIRuntime
19: {
20: use Nette\StaticClass;
21:
22: 23: 24:
25: public static function initialize(Latte\Runtime\Template $template, &$parentName, array $blocks)
26: {
27: $providers = $template->global;
28: $blocks = array_filter(array_keys($blocks), function ($s) { return $s[0] !== '_'; });
29: if (
30: $parentName === null
31: && $blocks
32: && !$template->getReferringTemplate()
33: && isset($providers->uiControl) && $providers->uiControl instanceof Nette\Application\UI\Presenter
34: ) {
35: $parentName = $providers->uiControl->findLayoutTemplateFile();
36: }
37:
38:
39: $params = $template->getParameters();
40: if (empty($providers->uiControl) && isset($params['_control'])) {
41: trigger_error('Replace template variable $_control with provider: $latte->addProvider("uiControl", ...)', E_USER_DEPRECATED);
42: $providers->uiControl = $params['_control'];
43: }
44: if (empty($providers->uiPresenter) && isset($params['_presenter'])) {
45: trigger_error('Replace template variable $_presenter with provider: $latte->addProvider("uiPresenter", ...)', E_USER_DEPRECATED);
46: $providers->uiPresenter = $params['_presenter'];
47: }
48: }
49: }
50: