@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | trait FieldAsTrait { |
| 38 | 38 | |
| 39 | - abstract protected function _getFieldIdentifier($prefix, $name = ""); |
|
| 39 | + abstract protected function _getFieldIdentifier($prefix, $name=""); |
|
| 40 | 40 | |
| 41 | 41 | abstract public function setValueFunction($index, $callback); |
| 42 | 42 | |
@@ -44,16 +44,16 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | abstract protected function _getFieldCaption($index); |
| 46 | 46 | |
| 47 | - abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement = NULL, $parameters = NULL); |
|
| 47 | + abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL); |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * |
| 51 | 51 | * @param HtmlFormField $element |
| 52 | 52 | * @param array $attributes |
| 53 | 53 | */ |
| 54 | - protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance = null) { |
|
| 54 | + protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) { |
|
| 55 | 55 | if (isset($attributes["jsCallback"])) { |
| 56 | - $callback = $attributes["jsCallback"]; |
|
| 56 | + $callback=$attributes["jsCallback"]; |
|
| 57 | 57 | if (\is_callable($callback)) { |
| 58 | 58 | $callback($element, $instance, $index, InstanceViewer::$index); |
| 59 | 59 | } |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | $element->fromArray($attributes); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - private function _getLabelField($caption, $icon = NULL) { |
|
| 68 | - $label = new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon); |
|
| 67 | + private function _getLabelField($caption, $icon=NULL) { |
|
| 68 | + $label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon); |
|
| 69 | 69 | return $label; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | protected function _addRules(HtmlFormField $element, &$attributes) { |
| 73 | 73 | if (isset($attributes["rules"])) { |
| 74 | - $this->_hasRules = true; |
|
| 75 | - $rules = $attributes["rules"]; |
|
| 74 | + $this->_hasRules=true; |
|
| 75 | + $rules=$attributes["rules"]; |
|
| 76 | 76 | if (\is_array($rules)) { |
| 77 | 77 | $element->addRules($rules); |
| 78 | 78 | } else { |
@@ -88,62 +88,62 @@ discard block |
||
| 88 | 88 | return $field; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - protected function _fieldAs($elementCallback, &$index, $attributes = NULL, $prefix = null) { |
|
| 92 | - $this->setValueFunction($index, function ($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) { |
|
| 93 | - $caption = $this->_getFieldCaption($index); |
|
| 94 | - $name = $this->_getFieldName($index); |
|
| 95 | - $id = $this->_getFieldIdentifier($prefix, $name); |
|
| 91 | + protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) { |
|
| 92 | + $this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) { |
|
| 93 | + $caption=$this->_getFieldCaption($index); |
|
| 94 | + $name=$this->_getFieldName($index); |
|
| 95 | + $id=$this->_getFieldIdentifier($prefix, $name); |
|
| 96 | 96 | if (isset($attributes["name"])) { |
| 97 | - $name = $attributes["name"]; |
|
| 97 | + $name=$attributes["name"]; |
|
| 98 | 98 | unset($attributes["name"]); |
| 99 | 99 | } |
| 100 | - $element = $elementCallback($id, $name, $value, $caption); |
|
| 100 | + $element=$elementCallback($id, $name, $value, $caption); |
|
| 101 | 101 | if (\is_array($attributes)) { |
| 102 | 102 | $this->_applyAttributes($element, $attributes, $index, $instance); |
| 103 | 103 | } |
| 104 | - $element->setDisabled(! $this->_edition); |
|
| 104 | + $element->setDisabled(!$this->_edition); |
|
| 105 | 105 | return $element; |
| 106 | 106 | }); |
| 107 | 107 | return $this; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function fieldAsProgress($index, $label = NULL, $attributes = array()) { |
|
| 111 | - $this->setValueFunction($index, function ($value) use ($label, $attributes) { |
|
| 112 | - $pb = new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes); |
|
| 110 | + public function fieldAsProgress($index, $label=NULL, $attributes=array()) { |
|
| 111 | + $this->setValueFunction($index, function($value) use ($label, $attributes) { |
|
| 112 | + $pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes); |
|
| 113 | 113 | return $pb; |
| 114 | 114 | }); |
| 115 | 115 | return $this; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function fieldAsRating($index, $max = 5, $icon = "") { |
|
| 119 | - $this->setValueFunction($index, function ($value) use ($max, $icon) { |
|
| 120 | - $rating = new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon); |
|
| 118 | + public function fieldAsRating($index, $max=5, $icon="") { |
|
| 119 | + $this->setValueFunction($index, function($value) use ($max, $icon) { |
|
| 120 | + $rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon); |
|
| 121 | 121 | return $rating; |
| 122 | 122 | }); |
| 123 | 123 | return $this; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function fieldAsLabel($index, $icon = NULL, $attributes = NULL) { |
|
| 127 | - return $this->_fieldAs(function ($id, $name, $value) use ($icon) { |
|
| 128 | - $lbl = new HtmlLabel($id, $value); |
|
| 126 | + public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) { |
|
| 127 | + return $this->_fieldAs(function($id, $name, $value) use ($icon) { |
|
| 128 | + $lbl=new HtmlLabel($id, $value); |
|
| 129 | 129 | if (isset($icon)) |
| 130 | 130 | $lbl->addIcon($icon); |
| 131 | 131 | return $lbl; |
| 132 | 132 | }, $index, $attributes, "label"); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - public function fieldAsHeader($index, $niveau = 1, $icon = NULL, $attributes = NULL) { |
|
| 136 | - return $this->_fieldAs(function ($id, $name, $value) use ($niveau, $icon) { |
|
| 137 | - $header = new HtmlHeader($id, $niveau, $value); |
|
| 135 | + public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) { |
|
| 136 | + return $this->_fieldAs(function($id, $name, $value) use ($niveau, $icon) { |
|
| 137 | + $header=new HtmlHeader($id, $niveau, $value); |
|
| 138 | 138 | if (isset($icon)) |
| 139 | 139 | $header->asIcon($icon, $value); |
| 140 | 140 | return $header; |
| 141 | 141 | }, $index, $attributes, "header"); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function fieldAsImage($index, $size = Size::MINI, $circular = false) { |
|
| 145 | - $this->setValueFunction($index, function ($img) use ($size, $circular) { |
|
| 146 | - $image = new HtmlImage($this->_getFieldIdentifier("image"), $img); |
|
| 144 | + public function fieldAsImage($index, $size=Size::MINI, $circular=false) { |
|
| 145 | + $this->setValueFunction($index, function($img) use ($size, $circular) { |
|
| 146 | + $image=new HtmlImage($this->_getFieldIdentifier("image"), $img); |
|
| 147 | 147 | $image->setSize($size); |
| 148 | 148 | if ($circular) |
| 149 | 149 | $image->setCircular(); |
@@ -153,65 +153,65 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | public function fieldAsFlag($index) { |
| 156 | - $this->setValueFunction($index, function ($flag) { |
|
| 157 | - $flag = new HtmlFlag($this->_getFieldIdentifier("flag"), $flag); |
|
| 156 | + $this->setValueFunction($index, function($flag) { |
|
| 157 | + $flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag); |
|
| 158 | 158 | return $flag; |
| 159 | 159 | }); |
| 160 | 160 | return $this; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function fieldAsIcon($index) { |
| 164 | - $this->setValueFunction($index, function ($icon) { |
|
| 165 | - $icon = new HtmlIcon($this->_getFieldIdentifier("icon"), $icon); |
|
| 164 | + $this->setValueFunction($index, function($icon) { |
|
| 165 | + $icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon); |
|
| 166 | 166 | return $icon; |
| 167 | 167 | }); |
| 168 | 168 | return $this; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function fieldAsAvatar($index, $attributes = NULL) { |
|
| 172 | - return $this->_fieldAs(function ($id, $name, $value) { |
|
| 173 | - $img = new HtmlImage($id, $value); |
|
| 171 | + public function fieldAsAvatar($index, $attributes=NULL) { |
|
| 172 | + return $this->_fieldAs(function($id, $name, $value) { |
|
| 173 | + $img=new HtmlImage($id, $value); |
|
| 174 | 174 | $img->asAvatar(); |
| 175 | 175 | return $img; |
| 176 | 176 | }, $index, $attributes, "avatar"); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function fieldAsRadio($index, $attributes = NULL) { |
|
| 180 | - return $this->_fieldAs(function ($id, $name, $value) use ($attributes) { |
|
| 181 | - $input = new HtmlFormRadio($id, $name, $value, $value); |
|
| 179 | + public function fieldAsRadio($index, $attributes=NULL) { |
|
| 180 | + return $this->_fieldAs(function($id, $name, $value) use ($attributes) { |
|
| 181 | + $input=new HtmlFormRadio($id, $name, $value, $value); |
|
| 182 | 182 | return $this->_prepareFormFields($input, $name, $attributes); |
| 183 | 183 | }, $index, $attributes, "radio"); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - public function fieldAsRadios($index, $elements = [], $attributes = NULL) { |
|
| 187 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements) { |
|
| 186 | + public function fieldAsRadios($index, $elements=[], $attributes=NULL) { |
|
| 187 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements) { |
|
| 188 | 188 | return HtmlFormFields::radios($name, $elements, $caption, $value); |
| 189 | 189 | }, $index, $attributes, "radios"); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - public function fieldAsList($index, $classNames = "", $attributes = NULL) { |
|
| 193 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($classNames) { |
|
| 194 | - $result = new HtmlList($name, $value); |
|
| 192 | + public function fieldAsList($index, $classNames="", $attributes=NULL) { |
|
| 193 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($classNames) { |
|
| 194 | + $result=new HtmlList($name, $value); |
|
| 195 | 195 | $result->addClass($classNames); |
| 196 | 196 | return $result; |
| 197 | 197 | }, $index, $attributes, "list"); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - public function fieldAsInput($index, $attributes = NULL) { |
|
| 201 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) { |
|
| 202 | - $input = new HtmlFormInput($id, $caption, "text", $value); |
|
| 200 | + public function fieldAsInput($index, $attributes=NULL) { |
|
| 201 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) { |
|
| 202 | + $input=new HtmlFormInput($id, $caption, "text", $value); |
|
| 203 | 203 | return $this->_prepareFormFields($input, $name, $attributes); |
| 204 | 204 | }, $index, $attributes, "input"); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - public function fieldAsLabeledInput($index, $attributes = NULL) { |
|
| 208 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) { |
|
| 209 | - $input = new HtmlFormInput($id, '', 'text', $value, $caption); |
|
| 210 | - $required = ''; |
|
| 207 | + public function fieldAsLabeledInput($index, $attributes=NULL) { |
|
| 208 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) { |
|
| 209 | + $input=new HtmlFormInput($id, '', 'text', $value, $caption); |
|
| 210 | + $required=''; |
|
| 211 | 211 | if (isset($attributes['rules'])) { |
| 212 | - $rules = json_encode($attributes['rules']); |
|
| 213 | - if (strpos($rules, 'empty') !== false) { |
|
| 214 | - $required = 'required'; |
|
| 212 | + $rules=json_encode($attributes['rules']); |
|
| 213 | + if (strpos($rules, 'empty')!==false) { |
|
| 214 | + $required='required'; |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | $input->getField() |
@@ -222,80 +222,80 @@ discard block |
||
| 222 | 222 | }, $index, $attributes, 'input'); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - public function fieldAsDataList($index, ?array $items = [], $attributes = NULL) { |
|
| 226 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $items) { |
|
| 227 | - $input = new HtmlFormInput($id, $caption, "text", $value); |
|
| 225 | + public function fieldAsDataList($index, ?array $items=[], $attributes=NULL) { |
|
| 226 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $items) { |
|
| 227 | + $input=new HtmlFormInput($id, $caption, "text", $value); |
|
| 228 | 228 | $input->getField() |
| 229 | 229 | ->addDataList($items); |
| 230 | 230 | return $this->_prepareFormFields($input, $name, $attributes); |
| 231 | 231 | }, $index, $attributes, "input"); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function fieldAsFile($index, $attributes = NULL) { |
|
| 234 | + public function fieldAsFile($index, $attributes=NULL) { |
|
| 235 | 235 | if (isset($this->_form)) { |
| 236 | 236 | $this->_form->setProperty('enctype', 'multipart/form-data'); |
| 237 | 237 | } |
| 238 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) { |
|
| 239 | - $input = new HtmlFormInput($id, $caption); |
|
| 238 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) { |
|
| 239 | + $input=new HtmlFormInput($id, $caption); |
|
| 240 | 240 | $input->asFile(); |
| 241 | 241 | return $this->_prepareFormFields($input, $name, $attributes); |
| 242 | 242 | }, $index, $attributes, "input"); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - public function fieldAsTextarea($index, $attributes = NULL) { |
|
| 246 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) { |
|
| 247 | - $textarea = new HtmlFormTextarea($id, $caption, $value); |
|
| 245 | + public function fieldAsTextarea($index, $attributes=NULL) { |
|
| 246 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) { |
|
| 247 | + $textarea=new HtmlFormTextarea($id, $caption, $value); |
|
| 248 | 248 | return $this->_prepareFormFields($textarea, $name, $attributes); |
| 249 | 249 | }, $index, $attributes, "textarea"); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - public function fieldAsElement($index, $tagName = "div", $baseClass = "", $attributes = NULL) { |
|
| 253 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) { |
|
| 254 | - $div = new HtmlSemDoubleElement($id, $tagName, $baseClass); |
|
| 252 | + public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) { |
|
| 253 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) { |
|
| 254 | + $div=new HtmlSemDoubleElement($id, $tagName, $baseClass); |
|
| 255 | 255 | $div->setContent(\htmlentities($value)); |
| 256 | - $textarea = new HtmlFormField("field-" . $id, $div, $caption); |
|
| 256 | + $textarea=new HtmlFormField("field-".$id, $div, $caption); |
|
| 257 | 257 | return $this->_prepareFormFields($textarea, $name, $attributes); |
| 258 | 258 | }, $index, $attributes, "element"); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - public function fieldAsHidden($index, $attributes = NULL) { |
|
| 262 | - if (! \is_array($attributes)) { |
|
| 263 | - $attributes = []; |
|
| 261 | + public function fieldAsHidden($index, $attributes=NULL) { |
|
| 262 | + if (!\is_array($attributes)) { |
|
| 263 | + $attributes=[]; |
|
| 264 | 264 | } |
| 265 | - $attributes["inputType"] = "hidden"; |
|
| 266 | - $attributes["style"] = "display:none;"; |
|
| 265 | + $attributes["inputType"]="hidden"; |
|
| 266 | + $attributes["style"]="display:none;"; |
|
| 267 | 267 | return $this->fieldAsInput($index, $attributes); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - public function fieldAsCheckbox($index, $attributes = NULL) { |
|
| 271 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) { |
|
| 272 | - if ($caption === null || $caption === "") |
|
| 273 | - $caption = ""; |
|
| 274 | - $input = new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier()); |
|
| 270 | + public function fieldAsCheckbox($index, $attributes=NULL) { |
|
| 271 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) { |
|
| 272 | + if ($caption===null || $caption==="") |
|
| 273 | + $caption=""; |
|
| 274 | + $input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier()); |
|
| 275 | 275 | $input->setChecked(JString::isBooleanTrue($value)); |
| 276 | 276 | return $this->_prepareFormFields($input, $name, $attributes); |
| 277 | 277 | }, $index, $attributes, "ck"); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - public function fieldAsDropDown($index, $elements = [], $multiple = false, $attributes = NULL) { |
|
| 281 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements, $multiple, $attributes) { |
|
| 282 | - $dd = new HtmlFormDropdown($id, $elements, $caption, $value ?? ''); |
|
| 280 | + public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) { |
|
| 281 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements, $multiple, $attributes) { |
|
| 282 | + $dd=new HtmlFormDropdown($id, $elements, $caption, $value ?? ''); |
|
| 283 | 283 | $dd->asSelect($name, $multiple); |
| 284 | 284 | return $this->_prepareFormFields($dd, $name, $attributes); |
| 285 | 285 | }, $index, $attributes, "dd"); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - public function fieldAsMessage($index, $attributes = NULL) { |
|
| 289 | - return $this->_fieldAs(function ($id, $name, $value, $caption) { |
|
| 290 | - $mess = new HtmlMessage("message-" . $id, $caption); |
|
| 288 | + public function fieldAsMessage($index, $attributes=NULL) { |
|
| 289 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 290 | + $mess=new HtmlMessage("message-".$id, $caption); |
|
| 291 | 291 | $mess->addHeader($value); |
| 292 | 292 | return $mess; |
| 293 | 293 | }, $index, $attributes, "message"); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - public function fieldAsLink($index, $attributes = NULL) { |
|
| 297 | - return $this->_fieldAs(function ($id, $name, $value, $caption) { |
|
| 298 | - $lnk = new HtmlLink("message-" . $id, "#", $caption); |
|
| 296 | + public function fieldAsLink($index, $attributes=NULL) { |
|
| 297 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 298 | + $lnk=new HtmlLink("message-".$id, "#", $caption); |
|
| 299 | 299 | return $lnk; |
| 300 | 300 | }, $index, $attributes, "link"); |
| 301 | 301 | } |
@@ -307,28 +307,28 @@ discard block |
||
| 307 | 307 | * an array or associative array $type=>$attributes |
| 308 | 308 | */ |
| 309 | 309 | public function fieldsAs(array $types) { |
| 310 | - $i = 0; |
|
| 310 | + $i=0; |
|
| 311 | 311 | if (JArray::isAssociative($types)) { |
| 312 | 312 | foreach ($types as $type => $attributes) { |
| 313 | 313 | if (\is_int($type)) |
| 314 | - $this->fieldAs($i ++, $attributes, []); |
|
| 314 | + $this->fieldAs($i++, $attributes, []); |
|
| 315 | 315 | else { |
| 316 | - $type = preg_replace('/\d/', '', $type); |
|
| 317 | - $this->fieldAs($i ++, $type, $attributes); |
|
| 316 | + $type=preg_replace('/\d/', '', $type); |
|
| 317 | + $this->fieldAs($i++, $type, $attributes); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | } else { |
| 321 | 321 | foreach ($types as $type) { |
| 322 | - $this->fieldAs($i ++, $type); |
|
| 322 | + $this->fieldAs($i++, $type); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - public function fieldAs($index, $type, $attributes = NULL) { |
|
| 328 | - $method = "fieldAs" . \ucfirst($type); |
|
| 327 | + public function fieldAs($index, $type, $attributes=NULL) { |
|
| 328 | + $method="fieldAs".\ucfirst($type); |
|
| 329 | 329 | if (\method_exists($this, $method)) { |
| 330 | - if (! \is_array($attributes)) { |
|
| 331 | - $attributes = [ |
|
| 330 | + if (!\is_array($attributes)) { |
|
| 331 | + $attributes=[ |
|
| 332 | 332 | $index |
| 333 | 333 | ]; |
| 334 | 334 | } else { |
@@ -341,17 +341,17 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - public function fieldAsSubmit($index, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $attributes = NULL) { |
|
| 345 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) { |
|
| 346 | - $button = new HtmlButton($id, $caption, $cssStyle); |
|
| 344 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
| 345 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) { |
|
| 346 | + $button=new HtmlButton($id, $caption, $cssStyle); |
|
| 347 | 347 | $this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]); |
| 348 | 348 | return $button; |
| 349 | 349 | }, $index, $attributes, "submit"); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - public function fieldAsButton($index, $cssStyle = NULL, $attributes = NULL) { |
|
| 353 | - return $this->_fieldAs(function ($id, $name, $value, $caption) use ($cssStyle) { |
|
| 354 | - $button = new HtmlButton($id, $value, $cssStyle); |
|
| 352 | + public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) { |
|
| 353 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle) { |
|
| 354 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 355 | 355 | return $button; |
| 356 | 356 | }, $index, $attributes, "button"); |
| 357 | 357 | } |