1 | <?php |
||
37 | class HtmlHelper extends CakeHtmlHelper |
||
38 | { |
||
39 | |||
40 | use HelperTrait, IncludeTrait, MaterializeCssTrait; |
||
41 | |||
42 | /** |
||
43 | * List of helpers used by this helper. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | public $helpers = [ |
||
48 | 'Core.Less', |
||
49 | 'Core.Document', |
||
50 | 'Url' => ['className' => 'Core.Url'] |
||
51 | ]; |
||
52 | |||
53 | /** |
||
54 | * Hold assets data. |
||
55 | * |
||
56 | * @var array |
||
57 | */ |
||
58 | protected $_assets = [ |
||
59 | 'styles' => [], |
||
60 | 'scripts' => [] |
||
61 | ]; |
||
62 | |||
63 | /** |
||
64 | * HtmlHelper constructor. |
||
65 | * |
||
66 | * @param View $View |
||
67 | * @param array $config |
||
68 | */ |
||
69 | public function __construct(View $View, array $config = []) |
||
83 | |||
84 | /** |
||
85 | * Constructor hook method. Implement this method to avoid having to overwrite the constructor and call parent. |
||
86 | * |
||
87 | * @param array $config The configuration settings provided to this helper. |
||
88 | * @return void |
||
89 | */ |
||
90 | public function initialize(array $config) |
||
106 | |||
107 | /** |
||
108 | * Creates a link element for CSS stylesheets. |
||
109 | * |
||
110 | * @param array|string $path |
||
111 | * @param array $options |
||
112 | * @return null|string |
||
113 | */ |
||
114 | public function css($path, array $options = []) |
||
119 | |||
120 | /** |
||
121 | * Get sort assets included list. |
||
122 | * |
||
123 | * @param string $key |
||
124 | * @return array|null|string |
||
125 | */ |
||
126 | public function getAssets($key) |
||
135 | |||
136 | /** |
||
137 | * Create icon element. |
||
138 | * |
||
139 | * @param string $icon |
||
140 | * @param array $options |
||
141 | * @return null|string |
||
142 | */ |
||
143 | public function icon($icon = 'home', array $options = []) |
||
162 | |||
163 | /** |
||
164 | * Creates a CSS stylesheets from less. |
||
165 | * |
||
166 | * @param string|array $path |
||
167 | * @param array $options |
||
168 | * @return null|string |
||
169 | * |
||
170 | * @throws \JBZoo\Less\Exception |
||
171 | */ |
||
172 | public function less($path, array $options = []) |
||
194 | |||
195 | /** |
||
196 | * Create an html link. |
||
197 | * |
||
198 | * @param string $title |
||
199 | * @param null|string|array $url |
||
200 | * @param array $options |
||
201 | * @return string |
||
202 | */ |
||
203 | public function link($title, $url = null, array $options = []) |
||
230 | |||
231 | /** |
||
232 | * Returns one or many `<script>` tags depending on the number of scripts given. |
||
233 | * |
||
234 | * @param array|string $path |
||
235 | * @param array $options |
||
236 | * @return null|string |
||
237 | */ |
||
238 | public function script($path, array $options = []) |
||
242 | |||
243 | /** |
||
244 | * Create status icon or link. |
||
245 | * |
||
246 | * @param int $status |
||
247 | * @param array $url |
||
248 | * @param string $icon |
||
249 | * @return null|string |
||
250 | */ |
||
251 | public function status($status = 0, array $url = [], $icon = 'circle') |
||
264 | |||
265 | /** |
||
266 | * Create and render ajax toggle element. |
||
267 | * |
||
268 | * @param Entity $entity |
||
269 | * @param array $url |
||
270 | * @param array $data |
||
271 | * @return string |
||
272 | */ |
||
273 | public function toggle(Entity $entity, array $url = [], array $data = []) |
||
293 | |||
294 | /** |
||
295 | * Check if need escape link title. |
||
296 | * |
||
297 | * @param string $title |
||
298 | * @param bool $isClear |
||
299 | * @param array $options |
||
300 | * @return bool |
||
301 | */ |
||
302 | protected function _isEscapeTitle($title, $isClear, array $options = []) |
||
306 | |||
307 | /** |
||
308 | * Setup default title attr. |
||
309 | * |
||
310 | * @param string $title |
||
311 | * @param array $options |
||
312 | * @return array |
||
313 | */ |
||
314 | protected function _setTitleAttr($title, array $options = []) |
||
322 | } |
||
323 |