1 | <?php |
||
21 | trait FieldsTrait { |
||
22 | abstract public function addFields($fields=NULL,$label=NULL); |
||
24 | |||
25 | protected function createItem($value){ |
||
35 | |||
36 | protected function createCondition($value){ |
||
39 | |||
40 | public function addInputs($inputs,$fieldslabel=null){ |
||
50 | |||
51 | public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){ |
||
58 | |||
59 | public function addFieldRules($index,$rules){ |
||
66 | |||
67 | /** |
||
68 | * @param string $identifier |
||
69 | * @param array $items |
||
70 | * @param string $label |
||
71 | * @param string $value |
||
72 | * @param boolean $multiple |
||
73 | * @return HtmlDoubleElement |
||
74 | */ |
||
75 | public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
||
78 | |||
79 | /** |
||
80 | * @param string $identifier |
||
81 | * @param string $label |
||
82 | * @param string $type |
||
83 | * @param string $value |
||
84 | * @param string $placeholder |
||
85 | * @return HtmlFormInput |
||
86 | */ |
||
87 | public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
||
90 | |||
91 | /** |
||
92 | * @param string $identifier |
||
93 | * @param string $label |
||
94 | * @param string $value |
||
95 | * @param string $placeholder |
||
96 | * @param int $rows |
||
97 | * @return HtmlTextarea |
||
98 | */ |
||
99 | public function addTextarea($identifier, $label,$value=NULL,$placeholder=NULL,$rows=5){ |
||
102 | |||
103 | public function addPassword($identifier, $label=NULL){ |
||
106 | |||
107 | public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
||
110 | |||
111 | public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
||
114 | |||
115 | public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
||
118 | |||
119 | public function addElement($identifier,$content,$label,$tagName="div",$baseClass=""){ |
||
123 | } |
||
124 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.