Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types=1); |
||
10 | public function editable($value, Field $field, HTMLNode $previous): HTMLNode |
||
11 | { |
||
12 | $element = parent::editable($value, $field, $previous); |
||
13 | $input = $element->get('input')[0]; |
||
14 | $input->setAttributes(['type' => 'text', 'class' => 'datepicker']); |
||
15 | $id = $input->getAttribute('id')[0]; |
||
16 | $element->appendContent( |
||
17 | HTMLNode::factory( |
||
18 | 'script', |
||
19 | [], |
||
20 | "document.addEventListener('DOMContentLoaded', function() { |
||
21 | var elems = document.querySelectorAll('#${id}'); |
||
22 | var options = {'format': 'yyyy-mm-dd'}; |
||
23 | var instances = M.Datepicker.init(elems, options); |
||
24 | });", |
||
25 | true |
||
26 | ) |
||
27 | ); |
||
28 | return $element; |
||
29 | } |
||
31 |