1 | <?php |
||
21 | abstract class AbstractInput extends AbstractHelper |
||
22 | { |
||
23 | /** |
||
24 | * |
||
25 | * The input type. |
||
26 | * |
||
27 | * @var string |
||
28 | * |
||
29 | */ |
||
30 | protected $type; |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | * The input name. |
||
35 | * |
||
36 | * @var string |
||
37 | * |
||
38 | */ |
||
39 | protected $name; |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | * The current value of the input. |
||
44 | * |
||
45 | * @var mixed |
||
46 | * |
||
47 | */ |
||
48 | protected $value; |
||
49 | |||
50 | /** |
||
51 | * |
||
52 | * HTML attributes for the input. |
||
53 | * |
||
54 | * @var array |
||
55 | * |
||
56 | */ |
||
57 | protected $attribs = array(); |
||
58 | |||
59 | /** |
||
60 | * |
||
61 | * Value options for the input. |
||
62 | * |
||
63 | * @var array |
||
64 | * |
||
65 | */ |
||
66 | protected $options = array(); |
||
67 | |||
68 | /** |
||
69 | * |
||
70 | * Given a input spec, returns the HTML for the input. |
||
71 | * |
||
72 | * @param array $spec The input spec. |
||
73 | * |
||
74 | * @return string |
||
75 | * |
||
76 | */ |
||
77 | 12 | public function __invoke(array $spec = null) |
|
78 | { |
||
79 | 12 | if ($spec !== null) { |
|
80 | $this->prep($spec); |
||
81 | } |
||
82 | 12 | return $this; |
|
83 | 12 | } |
|
84 | |||
85 | /** |
||
86 | * |
||
87 | * Returns the HTML for this input. |
||
88 | * |
||
89 | * @return string |
||
90 | * |
||
91 | */ |
||
92 | abstract public function __toString(); |
||
93 | |||
94 | /** |
||
95 | * |
||
96 | * Prepares the properties on this helper. |
||
97 | * |
||
98 | * @param array $spec The specification array. |
||
99 | * |
||
100 | */ |
||
101 | 14 | protected function prep(array $spec) |
|
130 | } |
||
131 |