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