@@ -9,23 +9,23 @@ discard block |
||
9 | 9 | use Ajax\semantic\html\collections\form\HtmlFormCheckbox; |
10 | 10 | use Ajax\semantic\html\collections\form\HtmlFormRadio; |
11 | 11 | trait FieldsTrait { |
12 | - protected function createItem($value){ |
|
13 | - if(\is_array($value)){ |
|
14 | - $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))); |
|
12 | + protected function createItem($value) { |
|
13 | + if (\is_array($value)) { |
|
14 | + $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))); |
|
15 | 15 | return $itemO; |
16 | 16 | }else |
17 | 17 | return new HtmlFormInput($value); |
18 | 18 | } |
19 | 19 | |
20 | - public function addInputs($inputs,$fieldslabel=null){ |
|
20 | + public function addInputs($inputs, $fieldslabel=null) { |
|
21 | 21 | $fields=array(); |
22 | - foreach ($inputs as $input){ |
|
22 | + foreach ($inputs as $input) { |
|
23 | 23 | \extract($input); |
24 | - $f=new HtmlFormInput("",""); |
|
24 | + $f=new HtmlFormInput("", ""); |
|
25 | 25 | $f->fromArray($input); |
26 | 26 | $fields[]=$f; |
27 | 27 | } |
28 | - return $this->addFields($fields,$fieldslabel); |
|
28 | + return $this->addFields($fields, $fieldslabel); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,23 +36,23 @@ discard block |
||
36 | 36 | * @param string $multiple |
37 | 37 | * @return \Ajax\common\html\HtmlDoubleElement |
38 | 38 | */ |
39 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
40 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
39 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
40 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
44 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
43 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
44 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
45 | 45 | } |
46 | 46 | |
47 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
48 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
47 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
48 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
52 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
51 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
52 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
53 | 53 | } |
54 | 54 | |
55 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
56 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
55 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
56 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | \ No newline at end of file |
@@ -13,8 +13,9 @@ |
||
13 | 13 | if(\is_array($value)){ |
14 | 14 | $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))); |
15 | 15 | return $itemO; |
16 | - }else |
|
17 | - return new HtmlFormInput($value); |
|
16 | + } else { |
|
17 | + return new HtmlFormInput($value); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | public function addInputs($inputs,$fieldslabel=null){ |
@@ -3,11 +3,11 @@ |
||
3 | 3 | namespace Ajax\semantic\html\collections\form; |
4 | 4 | |
5 | 5 | trait TextFieldsTrait { |
6 | - public function setPlaceholder($value){ |
|
6 | + public function setPlaceholder($value) { |
|
7 | 7 | return $this->getField()->setPlaceholder($value); |
8 | 8 | } |
9 | 9 | |
10 | - public function setValue($value){ |
|
10 | + public function setValue($value) { |
|
11 | 11 | return $this->getField()->setValue($value); |
12 | 12 | } |
13 | 13 | } |
14 | 14 | \ No newline at end of file |