1 | <?php |
||
34 | 1 | abstract class BaseControl extends Application\UI\Control |
|
35 | { |
||
36 | const TEMPLATE_LAYOUT = 'layout'; |
||
37 | const TEMPLATE_CONFIRMER = 'template'; |
||
38 | |||
39 | /** |
||
40 | * @var string|NULL |
||
41 | */ |
||
42 | protected $templateFile = NULL; |
||
43 | |||
44 | /** |
||
45 | * @var string|NULL |
||
46 | */ |
||
47 | protected $layoutFile = NULL; |
||
48 | |||
49 | /** |
||
50 | * @var Localization\ITranslator |
||
51 | */ |
||
52 | protected $translator; |
||
53 | |||
54 | /** |
||
55 | * @param Localization\ITranslator $translator |
||
56 | */ |
||
57 | public function injectTranslator(Localization\ITranslator $translator = NULL) |
||
61 | |||
62 | /** |
||
63 | * Change default control template path |
||
64 | * |
||
65 | * @param string $templateFile |
||
66 | * @param string $type |
||
67 | * |
||
68 | * @return void |
||
69 | * |
||
70 | * @throws Exceptions\FileNotFoundException |
||
71 | * @throws Exceptions\InvalidArgumentException |
||
72 | */ |
||
73 | public function setTemplateFilePath(string $templateFile, string $type) |
||
95 | |||
96 | /** |
||
97 | 1 | * @param Localization\ITranslator $translator |
|
98 | * |
||
99 | * @return void |
||
100 | */ |
||
101 | 1 | public function setTranslator(Localization\ITranslator $translator) |
|
105 | |||
106 | /** |
||
107 | * @return Localization\ITranslator|NULL |
||
108 | */ |
||
109 | public function getTranslator() |
||
117 | |||
118 | /** |
||
119 | * Render control |
||
120 | 1 | * |
|
121 | * @return Application\UI\ITemplate |
||
122 | * |
||
123 | * @throws Exceptions\InvalidStateException |
||
124 | 1 | */ |
|
125 | public function render() |
||
140 | |||
141 | /** |
||
142 | * @param string $templateFile |
||
143 | * |
||
144 | 1 | * @return string |
|
145 | */ |
||
146 | private function transformToTemplateFilePath(string $templateFile) : string |
||
162 | } |
||
163 |