1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
namespace Laminas\Form;
use Traversable;
interface ElementInterface
{
/**
* Set the name of this element
*
* In most cases, this will proxy to the attributes for storage, but is
* present to indicate that elements are generally named.
*
* @param string $name
* @return $this
*/
public function setName($name);
/**
* Retrieve the element name
*
* @return string
*/
public function getName();
/**
* Set options for an element
*
* @param array|Traversable $options
* @return $this
*/
public function setOptions($options);
/**
* Set a single option for an element
*
* @param string $key
* @param mixed $value
* @return $this
*/
public function setOption($key, $value);
/**
* get the defined options
*
* @return array
*/
public function getOptions();
/**
* return the specified option
*
* @param string $option
* @return null|mixed
*/
public function getOption($option);
/**
* Set a single element attribute
*
* @param string $key
* @param mixed $value
* @return $this
*/
public function setAttribute($key, $value);
/**
* Retrieve a single element attribute
*
* @param string $key
* @return mixed
*/
public function getAttribute($key);
/**
* Return true if a specific attribute is set
*
* @param string $key
* @return bool
*/
public function hasAttribute($key);
/**
* Set many attributes at once
*
* Implementation will decide if this will overwrite or merge.
*
* @param array|Traversable $arrayOrTraversable
* @return $this
*/
public function setAttributes($arrayOrTraversable);
/**
* Retrieve all attributes at once
*
* @return array|Traversable
*/
public function getAttributes();
/**
* Set the value of the element
*
* @param mixed $value
* @return $this
*/
public function setValue($value);
/**
* Retrieve the element value
*
* @return mixed
*/
public function getValue();
/**
* Set the label (if any) used for this element
*
* @param $label
* @return $this
*/
public function setLabel($label);
/**
* Retrieve the label (if any) used for this element
*
* @return string
*/
public function getLabel();
/**
* Set a list of messages to report when validation fails
*
* @param array|Traversable $messages
* @return $this
*/
public function setMessages($messages);
/**
* Get validation error messages, if any
*
* Returns a list of validation failure messages, if any.
*
* @return array|Traversable
*/
public function getMessages();
}