1 | <?php |
||
37 | 1 | class Slug extends Forms\Controls\TextInput |
|
38 | { |
||
39 | /** |
||
40 | * @var string|NULL |
||
41 | */ |
||
42 | private $templateFile; |
||
43 | |||
44 | /** |
||
45 | * @var UI\ITemplate |
||
46 | */ |
||
47 | private $template; |
||
48 | |||
49 | /** |
||
50 | * @var UI\ITemplateFactory |
||
51 | */ |
||
52 | private $templateFactory; |
||
53 | |||
54 | /** |
||
55 | * @var Forms\Controls\BaseControl[] |
||
56 | */ |
||
57 | private $fields = []; |
||
58 | |||
59 | /** |
||
60 | * Toggle box selector |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | private $toggleBox = '.ipub-slug-box'; |
||
65 | |||
66 | /** |
||
67 | * @var bool |
||
68 | */ |
||
69 | private static $registered = FALSE; |
||
70 | |||
71 | /** |
||
72 | * Enable or disable one time auto updating slug field from watched fields |
||
73 | * |
||
74 | * @var bool |
||
75 | */ |
||
76 | private $onetimeAutoUpdate = TRUE; |
||
77 | |||
78 | /** |
||
79 | * @param UI\ITemplateFactory $templateFactory |
||
80 | * @param string|NULL $label |
||
81 | * @param int|NULL $maxLength |
||
82 | */ |
||
83 | public function __construct(UI\ITemplateFactory $templateFactory, string $label = NULL, int $maxLength = NULL) |
||
89 | |||
90 | /** |
||
91 | * Add filed from which slug will be created |
||
92 | * |
||
93 | * @param Forms\Controls\BaseControl $field |
||
94 | * |
||
95 | * @return self |
||
96 | */ |
||
97 | public function addField(Forms\Controls\BaseControl $field) : self |
||
104 | |||
105 | /** |
||
106 | * Generates control's HTML element |
||
107 | * |
||
108 | * @return Utils\Html |
||
109 | */ |
||
110 | public function getControl() : Utils\Html |
||
146 | |||
147 | /** |
||
148 | * Change default control template path |
||
149 | * |
||
150 | * @param string $templateFile |
||
151 | * |
||
152 | * @return void |
||
153 | * |
||
154 | * @throws Exceptions\FileNotFoundException |
||
155 | */ |
||
156 | public function setTemplateFile(string $templateFile) : void |
||
172 | |||
173 | /** |
||
174 | * @return string |
||
175 | */ |
||
176 | private function getTemplateFile() : string |
||
180 | |||
181 | /** |
||
182 | * @return UI\ITemplate|Bridges\ApplicationLatte\Template |
||
183 | */ |
||
184 | private function getTemplate() : UI\ITemplate |
||
193 | |||
194 | /** |
||
195 | * @param UI\ITemplateFactory $templateFactory |
||
196 | * @param string $method |
||
197 | * |
||
198 | * @return void |
||
199 | */ |
||
200 | public static function register(UI\ITemplateFactory $templateFactory, $method = 'addSlug') : void |
||
220 | } |
||
221 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: