1 | <?php |
||
23 | abstract class AbstractElement implements ElementInterface |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $settings = [ |
||
30 | 'multiple' => false |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * Add attribute manipulation methods |
||
35 | */ |
||
36 | use AttributesAwareMethods; |
||
37 | |||
38 | /** |
||
39 | * Add render capabilities to element |
||
40 | */ |
||
41 | use RenderAwareMethods; |
||
42 | |||
43 | /** |
||
44 | * @var string|mixed |
||
45 | */ |
||
46 | protected $value; |
||
47 | |||
48 | /** |
||
49 | * @var null|string |
||
50 | */ |
||
51 | protected $name = null; |
||
52 | |||
53 | /** |
||
54 | * @var string Renderer class |
||
55 | */ |
||
56 | protected $rendererClass = Div::class; |
||
57 | |||
58 | /** |
||
59 | * @var RendererInterface |
||
60 | */ |
||
61 | protected $renderer; |
||
62 | |||
63 | /** |
||
64 | * @var bool |
||
65 | */ |
||
66 | protected $rendering = false; |
||
67 | |||
68 | /** |
||
69 | * Gets the element value |
||
70 | * |
||
71 | * This value here is just a string and it can be the content that |
||
72 | * goes inside <label> tags for example. |
||
73 | * |
||
74 | * @return mixed |
||
75 | */ |
||
76 | 32 | public function getValue() |
|
80 | |||
81 | /** |
||
82 | * Sets the value or content of the element |
||
83 | * |
||
84 | * @param mixed $value |
||
85 | * |
||
86 | * @return mixed |
||
87 | */ |
||
88 | 80 | public function setValue($value) |
|
96 | |||
97 | /** |
||
98 | * Returns element name |
||
99 | * |
||
100 | * @return null|string |
||
101 | */ |
||
102 | 36 | public function getName() |
|
106 | |||
107 | /** |
||
108 | * Sets element name |
||
109 | * |
||
110 | * @param string $name |
||
111 | * |
||
112 | * @return $this|self|AbstractElement |
||
113 | */ |
||
114 | 34 | public function setName($name) |
|
119 | |||
120 | /** |
||
121 | * Gets the HTML renderer for this element |
||
122 | * |
||
123 | * @return RendererInterface |
||
124 | */ |
||
125 | 20 | protected function getRenderer() |
|
132 | |||
133 | /** |
||
134 | * Sets internal renderer |
||
135 | * |
||
136 | * @param RendererInterface $renderer |
||
137 | * |
||
138 | * @return $this|self|AbstractElement |
||
139 | */ |
||
140 | 20 | protected function setRenderer(RendererInterface $renderer) |
|
145 | |||
146 | /** |
||
147 | * Set other input settings |
||
148 | * |
||
149 | * @param array $settings |
||
150 | * @return self|AbstractElement |
||
151 | */ |
||
152 | public function setSettings(array $settings) |
||
157 | |||
158 | /** |
||
159 | * Set rendering state |
||
160 | * |
||
161 | * @param bool $state |
||
162 | * |
||
163 | * @return self|$this|AbstractElement |
||
164 | */ |
||
165 | 20 | public function setRendering($state) |
|
170 | |||
171 | /** |
||
172 | * Check if input is being rendered |
||
173 | * |
||
174 | * @return boolean |
||
175 | */ |
||
176 | public function isRendering() |
||
180 | } |