1 | <?php |
||
22 | trait FieldsTrait { |
||
23 | abstract public function addFields($fields=NULL,$label=NULL); |
||
25 | |||
26 | protected function createItem($value){ |
||
36 | |||
37 | protected function createCondition($value){ |
||
40 | |||
41 | public function addInputs($inputs,$fieldslabel=null){ |
||
51 | |||
52 | public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){ |
||
59 | |||
60 | public function addFieldRules($index,$rules){ |
||
67 | |||
68 | /** |
||
69 | * Adds a new dropdown element |
||
70 | * @param string $identifier |
||
71 | * @param array $items |
||
72 | * @param string $label |
||
73 | * @param string $value |
||
74 | * @param boolean $multiple |
||
75 | * @return HtmlFormDropdown |
||
76 | */ |
||
77 | public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
||
80 | |||
81 | /** |
||
82 | * Adds a new button groups |
||
83 | * @param string $identifier |
||
84 | * @param array $elements |
||
85 | * @param boolean $asIcons |
||
86 | * @return HtmlButtonGroups |
||
87 | */ |
||
88 | public function addButtonGroups($identifier,$elements=[],$asIcons=false){ |
||
91 | |||
92 | /** |
||
93 | * Adds a button with a dropdown button |
||
94 | * @param string $identifier |
||
95 | * @param string $value |
||
96 | * @param array $items |
||
97 | * @param boolean $asCombo |
||
98 | * @param string $icon |
||
99 | * @return HtmlButtonGroups |
||
100 | */ |
||
101 | public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
||
104 | |||
105 | /** |
||
106 | * @param string $identifier |
||
107 | * @param string $label |
||
108 | * @param string $type |
||
109 | * @param string $value |
||
110 | * @param string $placeholder |
||
111 | * @return HtmlFormInput |
||
112 | */ |
||
113 | public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
||
116 | |||
117 | /** |
||
118 | * @param string $identifier |
||
119 | * @param string $label |
||
120 | * @param string $value |
||
121 | * @param string $placeholder |
||
122 | * @param int $rows |
||
123 | * @return HtmlTextarea |
||
124 | */ |
||
125 | public function addTextarea($identifier, $label,$value=NULL,$placeholder=NULL,$rows=5){ |
||
128 | |||
129 | public function addPassword($identifier, $label=NULL){ |
||
132 | |||
133 | public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
||
136 | |||
137 | public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
||
140 | |||
141 | public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
||
144 | |||
145 | public function addElement($identifier,$content,$label,$tagName="div",$baseClass=""){ |
||
149 | } |
||
150 |
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.