1 | <?php |
||
45 | abstract class Element extends \ArrayObject |
||
46 | { |
||
47 | use HasAttributesTrait; |
||
48 | use HasDataTrait; |
||
49 | |||
50 | /** |
||
51 | * Name of the field (identifier of the element in the form's child list) |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $name; |
||
56 | |||
57 | /** |
||
58 | * |
||
59 | * @param string $name |
||
60 | * Name of the form element that will make it identifiable |
||
61 | * @param array $specs |
||
62 | * Specification for the element (attributes, parents, etc) |
||
63 | */ |
||
64 | 51 | public function __construct($name, $specs = array()) |
|
72 | |||
73 | 44 | protected function inflectUnderscoreToClass($var) |
|
80 | |||
81 | 2 | public function get($key) |
|
90 | |||
91 | 44 | public function set($key, $value) |
|
101 | |||
102 | |||
103 | /** |
||
104 | * Returns the default element specifications |
||
105 | * The default specs are merged with the constructor specs |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | 9 | protected function getDefaultSpecs() |
|
113 | |||
114 | /** |
||
115 | * Retrieve the name of the form's element as registered within the form |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 14 | public function getName() |
|
123 | |||
124 | /** |
||
125 | * Sets the group this element belongs to |
||
126 | * |
||
127 | * @param null|string $group |
||
128 | * |
||
129 | * @return $this |
||
130 | */ |
||
131 | 1 | public function setGroup($group = null) |
|
137 | |||
138 | /** |
||
139 | * Retrieve the group this element belongs to |
||
140 | * |
||
141 | * @return null|string |
||
142 | */ |
||
143 | 9 | public function getGroup() |
|
147 | |||
148 | /** |
||
149 | * Sets the widget for this element |
||
150 | * |
||
151 | * @param null|string $widget |
||
152 | * |
||
153 | * @return $this |
||
154 | */ |
||
155 | 42 | public function setWidget($widget = null) |
|
161 | |||
162 | /** |
||
163 | * Retrieve the widget type for this element |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | 1 | public function getWidget() |
|
171 | |||
172 | /** |
||
173 | * Sets the display priority for this element |
||
174 | * |
||
175 | * @param integer $priority |
||
176 | * |
||
177 | * @return $this |
||
178 | */ |
||
179 | 8 | public function setPosition($priority = 0) |
|
185 | |||
186 | /** |
||
187 | * Retrieve display position for this element |
||
188 | * |
||
189 | * @return integer |
||
190 | */ |
||
191 | 1 | public function getPosition() |
|
195 | |||
196 | |||
197 | /** |
||
198 | * Prepares the input filter to receive data and be rendered |
||
199 | * It attaches the filters, validation rules, upload handler for the element |
||
200 | * |
||
201 | * @param InputFilter $inputFilter |
||
202 | */ |
||
203 | 9 | public function prepareInputFilter(InputFilter $inputFilter) |
|
212 | |||
213 | } |
||
214 |