Total Complexity | 6 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class TrixEditor extends AbstractFormField implements FormFieldInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $controlId; |
||
14 | |||
15 | /** |
||
16 | * |
||
17 | */ |
||
18 | public function __construct(string $controlId) |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Get the value of controlId |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | public function getControlId(): string |
||
31 | { |
||
32 | return $this->controlId; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * |
||
37 | */ |
||
38 | protected function resolveAttributes(): AbstractHtmlElement |
||
39 | { |
||
40 | return parent::resolveAttributes() |
||
41 | ->addAttribute('input', $this->controlId); |
||
|
|||
42 | } |
||
43 | |||
44 | /** |
||
45 | * |
||
46 | */ |
||
47 | protected function renderHtmlMarkup(): string |
||
48 | { |
||
49 | $control = $this->createEditorFormControl() |
||
50 | ->setName($this->name) |
||
51 | ->setValue($this->value) |
||
52 | ->setId($this->controlId); |
||
53 | |||
54 | $editor = $this->tag('trix-editor', '', $this->attributes); |
||
55 | |||
56 | return $control . $editor; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * |
||
61 | */ |
||
62 | protected function createEditorFormControl(): Hidden |
||
63 | { |
||
64 | return new Hidden; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * |
||
69 | */ |
||
70 | protected function defineControlId(): string |
||
73 | } |
||
74 | } |
||
75 |