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 | public function injectTranslator(Localization\ITranslator $translator = NULL) |
||
63 | |||
64 | /** |
||
65 | * @param Localization\ITranslator $translator |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | public function setTranslator(Localization\ITranslator $translator) |
||
73 | |||
74 | /** |
||
75 | * @return Localization\ITranslator|NULL |
||
76 | */ |
||
77 | public function getTranslator() |
||
85 | |||
86 | /** |
||
87 | * Render control |
||
88 | * |
||
89 | * @return Application\UI\ITemplate |
||
90 | * |
||
91 | * @throws Exceptions\InvalidStateException |
||
92 | */ |
||
93 | public function render() |
||
108 | |||
109 | /** |
||
110 | * Change default control template path |
||
111 | * |
||
112 | * @param string $templateFile |
||
113 | * @param string $type |
||
114 | * |
||
115 | * @return void |
||
116 | * |
||
117 | * @throws Exceptions\FileNotFoundException |
||
118 | * @throws Exceptions\InvalidArgumentException |
||
119 | */ |
||
120 | protected function setTemplateFilePath(string $templateFile, string $type) |
||
142 | |||
143 | /** |
||
144 | * @param string $templateFile |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | private function transformToTemplateFilePath(string $templateFile) : string |
||
163 | } |
||
164 |