@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | parent::__construct($identifier, "div","field"); |
| 19 | 19 | $this->content=array(); |
| 20 | 20 | $this->_states=[State::ERROR,State::DISABLED]; |
| 21 | - if(isset($label) && $label!=="") |
|
| 22 | - $this->setLabel($label); |
|
| 21 | + if(isset($label) && $label!=="") { |
|
| 22 | + $this->setLabel($label); |
|
| 23 | + } |
|
| 23 | 24 | $this->setField($field); |
| 24 | 25 | $this->_validation=NULL; |
| 25 | 26 | } |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | * @return mixed |
| 51 | 52 | */ |
| 52 | 53 | public function getLabel(){ |
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 54 | - return $this->content["label"]; |
|
| 54 | + if(\array_key_exists("label", $this->content)) { |
|
| 55 | + return $this->content["label"]; |
|
| 56 | + } |
|
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | /** |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | $rules=$attributes["rules"]; |
| 63 | 63 | if(\is_array($rules)){ |
| 64 | 64 | $element->addRules($rules); |
| 65 | - } |
|
| 66 | - else{ |
|
| 65 | + } else{ |
|
| 67 | 66 | $element->addRule($rules); |
| 68 | 67 | } |
| 69 | 68 | unset($attributes["rules"]); |
@@ -123,8 +122,9 @@ discard block |
||
| 123 | 122 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 124 | 123 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 125 | 124 | $header=new HtmlHeader($id,$niveau,$value); |
| 126 | - if(isset($icon)) |
|
| 127 | - $header->asIcon($icon, $value); |
|
| 125 | + if(isset($icon)) { |
|
| 126 | + $header->asIcon($icon, $value); |
|
| 127 | + } |
|
| 128 | 128 | return $header; |
| 129 | 129 | }, $index,$attributes,"header"); |
| 130 | 130 | } |
@@ -132,7 +132,9 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 134 | 134 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 135 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 135 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 136 | + $image->setCircular(); |
|
| 137 | + } |
|
| 136 | 138 | return $image; |
| 137 | 139 | }); |
| 138 | 140 | return $this; |
@@ -221,14 +223,14 @@ discard block |
||
| 221 | 223 | $i=0; |
| 222 | 224 | if(JArray::isAssociative($types)){ |
| 223 | 225 | foreach ($types as $type=>$attributes){ |
| 224 | - if(\is_int($type)) |
|
| 225 | - $this->fieldAs($i++,$attributes,[]); |
|
| 226 | - else{ |
|
| 226 | + if(\is_int($type)) { |
|
| 227 | + $this->fieldAs($i++,$attributes,[]); |
|
| 228 | + } else{ |
|
| 227 | 229 | $type=preg_replace('/\d/', '', $type ); |
| 228 | 230 | $this->fieldAs($i++,$type,$attributes); |
| 229 | 231 | } |
| 230 | 232 | } |
| 231 | - }else{ |
|
| 233 | + } else{ |
|
| 232 | 234 | foreach ($types as $type){ |
| 233 | 235 | $this->fieldAs($i++,$type); |
| 234 | 236 | } |
@@ -240,7 +242,7 @@ discard block |
||
| 240 | 242 | if(\method_exists($this, $method)){ |
| 241 | 243 | if(!\is_array($attributes)){ |
| 242 | 244 | $attributes=[$index]; |
| 243 | - }else{ |
|
| 245 | + } else{ |
|
| 244 | 246 | \array_unshift($attributes, $index); |
| 245 | 247 | } |
| 246 | 248 | \call_user_func_array([$this,$method], $attributes); |
@@ -59,24 +59,26 @@ |
||
| 59 | 59 | foreach ($values as $v){ |
| 60 | 60 | $form->addField($v); |
| 61 | 61 | } |
| 62 | - }else{ |
|
| 62 | + } else{ |
|
| 63 | 63 | $separators[]=$count; |
| 64 | 64 | for($i=0;$i<$size;$i++){ |
| 65 | 65 | $wrapper=null; |
| 66 | 66 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
| 67 | - if(isset($headers[$separators[$i]+1])) |
|
| 68 | - $form->addHeader($headers[$separators[$i]+1],4,true); |
|
| 67 | + if(isset($headers[$separators[$i]+1])) { |
|
| 68 | + $form->addHeader($headers[$separators[$i]+1],4,true); |
|
| 69 | + } |
|
| 69 | 70 | if(isset($wrappers[$separators[$i]+1])){ |
| 70 | 71 | $wrapper=$wrappers[$separators[$i]+1]; |
| 71 | 72 | } |
| 72 | 73 | //TODO check why $fields is empty |
| 73 | 74 | if(\sizeof($fields)===1){ |
| 74 | 75 | $added=$form->addField($fields[0]); |
| 75 | - }elseif(\sizeof($fields)>1){ |
|
| 76 | + } elseif(\sizeof($fields)>1){ |
|
| 76 | 77 | $added=$form->addFields($fields); |
| 77 | 78 | } |
| 78 | - if(isset($wrapper)) |
|
| 79 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
| 79 | + if(isset($wrapper)) { |
|
| 80 | + $added->wrap($wrapper[0],$wrapper[1]); |
|
| 81 | + } |
|
| 80 | 82 | } |
| 81 | 83 | } |
| 82 | 84 | } |