@@ -11,33 +11,33 @@ discard block |
||
11 | 11 | use Ajax\semantic\html\collections\form\HtmlFormField; |
12 | 12 | |
13 | 13 | trait FieldsTrait { |
14 | - public abstract function addFields($fields=NULL,$label=NULL); |
|
14 | + public abstract function addFields($fields=NULL, $label=NULL); |
|
15 | 15 | public abstract function addItem($item); |
16 | 16 | |
17 | - protected function createItem($value){ |
|
18 | - if(\is_array($value)){ |
|
19 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
17 | + protected function createItem($value) { |
|
18 | + if (\is_array($value)) { |
|
19 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
20 | 20 | return $itemO; |
21 | - }elseif(\is_object($value)){ |
|
21 | + }elseif (\is_object($value)) { |
|
22 | 22 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
23 | 23 | return $itemO; |
24 | - }else |
|
24 | + } else |
|
25 | 25 | return new HtmlFormInput($value); |
26 | 26 | } |
27 | 27 | |
28 | - protected function createCondition($value){ |
|
28 | + protected function createCondition($value) { |
|
29 | 29 | return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput; |
30 | 30 | } |
31 | 31 | |
32 | - public function addInputs($inputs,$fieldslabel=null){ |
|
32 | + public function addInputs($inputs, $fieldslabel=null) { |
|
33 | 33 | $fields=array(); |
34 | - foreach ($inputs as $input){ |
|
34 | + foreach ($inputs as $input) { |
|
35 | 35 | \extract($input); |
36 | - $f=new HtmlFormInput("",""); |
|
36 | + $f=new HtmlFormInput("", ""); |
|
37 | 37 | $f->fromArray($input); |
38 | 38 | $fields[]=$f; |
39 | 39 | } |
40 | - return $this->addFields($fields,$fieldslabel); |
|
40 | + return $this->addFields($fields, $fieldslabel); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,27 +48,27 @@ discard block |
||
48 | 48 | * @param boolean $multiple |
49 | 49 | * @return \Ajax\common\html\HtmlDoubleElement |
50 | 50 | */ |
51 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
52 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
51 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
52 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
53 | 53 | } |
54 | 54 | |
55 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
56 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
55 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
56 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
57 | 57 | } |
58 | 58 | |
59 | - public function addPassword($identifier, $label=NULL){ |
|
60 | - return $this->addItem(new HtmlFormInput($identifier,$label,"password","","")); |
|
59 | + public function addPassword($identifier, $label=NULL) { |
|
60 | + return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", "")); |
|
61 | 61 | } |
62 | 62 | |
63 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
64 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
63 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
64 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
65 | 65 | } |
66 | 66 | |
67 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
68 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
67 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
68 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
69 | 69 | } |
70 | 70 | |
71 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
72 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
71 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
72 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |