1 | <?php |
||
35 | 1 | abstract class BaseControl extends Application\UI\Control |
|
36 | { |
||
37 | protected const TEMPLATE_LAYOUT = 'layout'; |
||
38 | protected const TEMPLATE_CONFIRMER = 'template'; |
||
39 | |||
40 | /** |
||
41 | * @var string|NULL |
||
42 | */ |
||
43 | protected $templateFile = NULL; |
||
44 | |||
45 | /** |
||
46 | * @var string|NULL |
||
47 | */ |
||
48 | protected $layoutFile = NULL; |
||
49 | |||
50 | /** |
||
51 | * @var Localization\ITranslator |
||
52 | */ |
||
53 | protected $translator; |
||
54 | |||
55 | /** |
||
56 | * @param Localization\ITranslator $translator |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | public function injectTranslator(Localization\ITranslator $translator = NULL) : void |
||
64 | |||
65 | /** |
||
66 | * @param Localization\ITranslator $translator |
||
67 | * |
||
68 | * @return void |
||
69 | */ |
||
70 | public function setTranslator(Localization\ITranslator $translator) : void |
||
74 | |||
75 | /** |
||
76 | * @return Localization\ITranslator|NULL |
||
77 | */ |
||
78 | public function getTranslator() : ?Localization\ITranslator |
||
86 | |||
87 | /** |
||
88 | * Render control |
||
89 | * |
||
90 | * @return Application\UI\ITemplate |
||
91 | * |
||
92 | * @throws Exceptions\InvalidStateException |
||
93 | */ |
||
94 | public function render() |
||
109 | |||
110 | /** |
||
111 | * Change default control template path |
||
112 | * |
||
113 | * @param string $templateFile |
||
114 | * @param string $type |
||
115 | * |
||
116 | * @return void |
||
117 | * |
||
118 | * @throws Exceptions\FileNotFoundException |
||
119 | * @throws Exceptions\InvalidArgumentException |
||
120 | */ |
||
121 | protected function setTemplateFilePath(string $templateFile, string $type) : void |
||
143 | |||
144 | /** |
||
145 | * @param string $templateFile |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | private function transformToTemplateFilePath(string $templateFile) : string |
||
164 | } |
||
165 |