@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | $rules=$attributes["rules"]; |
57 | 57 | if(\is_array($rules)){ |
58 | 58 | $element->addRules($rules); |
59 | - } |
|
60 | - else{ |
|
59 | + } else{ |
|
61 | 60 | $element->addRule($rules); |
62 | 61 | } |
63 | 62 | unset($attributes["rules"]); |
@@ -117,8 +116,9 @@ discard block |
||
117 | 116 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
118 | 117 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
119 | 118 | $header=new HtmlHeader($id,$niveau,$value); |
120 | - if(isset($icon)) |
|
121 | - $header->asIcon($icon, $value); |
|
119 | + if(isset($icon)) { |
|
120 | + $header->asIcon($icon, $value); |
|
121 | + } |
|
122 | 122 | return $header; |
123 | 123 | }, $index,$attributes,"header"); |
124 | 124 | } |
@@ -126,7 +126,9 @@ discard block |
||
126 | 126 | |
127 | 127 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
128 | 128 | $this->setValueFunction($index,function($img) use($size,$circular){ |
129 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
129 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
130 | + $image->setCircular(); |
|
131 | + } |
|
130 | 132 | return $image; |
131 | 133 | }); |
132 | 134 | return $this; |
@@ -51,8 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function addHeader($title, $niveau=1, $dividing=true) { |
53 | 53 | $header=new HtmlHeader("", $niveau, $title); |
54 | - if ($dividing) |
|
55 | - $header->setDividing(); |
|
54 | + if ($dividing) { |
|
55 | + $header->setDividing(); |
|
56 | + } |
|
56 | 57 | return $this->addItem($header); |
57 | 58 | } |
58 | 59 | |
@@ -73,14 +74,16 @@ discard block |
||
73 | 74 | if (\is_string($end)) { |
74 | 75 | $label=$end; |
75 | 76 | \array_pop($fields); |
76 | - } else |
|
77 | - $label=NULL; |
|
77 | + } else { |
|
78 | + $label=NULL; |
|
79 | + } |
|
78 | 80 | } |
79 | 81 | $this->_fields=\array_merge($this->_fields, $fields); |
80 | 82 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
81 | 83 | } |
82 | - if (isset($label)) |
|
83 | - $fields=new HtmlFormField("", $fields, $label); |
|
84 | + if (isset($label)) { |
|
85 | + $fields=new HtmlFormField("", $fields, $label); |
|
86 | + } |
|
84 | 87 | } else { |
85 | 88 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
86 | 89 | } |
@@ -133,20 +136,24 @@ discard block |
||
133 | 136 | */ |
134 | 137 | public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
135 | 138 | $message=new HtmlMessage($identifier, $content); |
136 | - if (isset($header)) |
|
137 | - $message->addHeader($header); |
|
138 | - if (isset($icon)) |
|
139 | - $message->setIcon($icon); |
|
140 | - if (isset($type)) |
|
141 | - $message->setStyle($type); |
|
139 | + if (isset($header)) { |
|
140 | + $message->addHeader($header); |
|
141 | + } |
|
142 | + if (isset($icon)) { |
|
143 | + $message->setIcon($icon); |
|
144 | + } |
|
145 | + if (isset($type)) { |
|
146 | + $message->setStyle($type); |
|
147 | + } |
|
142 | 148 | return $this->addItem($message); |
143 | 149 | } |
144 | 150 | |
145 | 151 | |
146 | 152 | |
147 | 153 | public function compile(JsUtils $js=NULL,&$view=NULL){ |
148 | - if(\sizeof($this->_validationParams)>0) |
|
149 | - $this->setProperty("novalidate", ""); |
|
154 | + if(\sizeof($this->_validationParams)>0) { |
|
155 | + $this->setProperty("novalidate", ""); |
|
156 | + } |
|
150 | 157 | return parent::compile($js,$view); |
151 | 158 | } |
152 | 159 | |
@@ -161,8 +168,9 @@ discard block |
||
161 | 168 | if($field instanceof HtmlFormFields){ |
162 | 169 | $items=$field->getItems(); |
163 | 170 | foreach ($items as $_field){ |
164 | - if($_field instanceof HtmlFormField) |
|
165 | - $compo=$this->addCompoValidation($js, $compo, $_field); |
|
171 | + if($_field instanceof HtmlFormField) { |
|
172 | + $compo=$this->addCompoValidation($js, $compo, $_field); |
|
173 | + } |
|
166 | 174 | } |
167 | 175 | } |
168 | 176 | } |
@@ -29,15 +29,17 @@ discard block |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (!\is_array($this->content)) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
34 | - else |
|
35 | - $this->content=array(); |
|
32 | + if(isset($this->content)) { |
|
33 | + $this->content=array ($this->content); |
|
34 | + } else { |
|
35 | + $this->content=array(); |
|
36 | + } |
|
37 | + } |
|
38 | + if($before) { |
|
39 | + array_unshift($this->content,$content); |
|
40 | + } else { |
|
41 | + $this->content []=$content; |
|
36 | 42 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
39 | - else |
|
40 | - $this->content []=$content; |
|
41 | 43 | return $this; |
42 | 44 | } |
43 | 45 | |
@@ -75,9 +77,9 @@ discard block |
||
75 | 77 | $instances=[]; |
76 | 78 | if($content instanceof $class){ |
77 | 79 | $instances[]=$content; |
78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
80 | + } elseif($content instanceof HtmlDoubleElement){ |
|
79 | 81 | $instances=\array_merge($instances,$content->getContentInstances($class)); |
80 | - }elseif (\is_array($content)){ |
|
82 | + } elseif (\is_array($content)){ |
|
81 | 83 | foreach ($content as $element){ |
82 | 84 | $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
83 | 85 | } |