@@ 69-80 (lines=12) @@ | ||
66 | return $this; |
|
67 | } |
|
68 | ||
69 | public function fieldAsInput($index,$name=NULL,$type="text",$placeholder=""){ |
|
70 | $this->setValueFunction($index,function($value) use($index,$name,$type,$placeholder){ |
|
71 | $input=new HtmlInput($this->_getFieldIdentifier("input"),$type,$value,$placeholder); |
|
72 | if(isset($name)===false){ |
|
73 | $name=$this->_instanceViewer->getCaption($index)."[]"; |
|
74 | } |
|
75 | $input->getField()->setProperty("name", $name); |
|
76 | return $input; |
|
77 | }); |
|
78 | return $this; |
|
79 | } |
|
80 | ||
81 | public function fieldAsCheckbox($index,$name=NULL){ |
|
82 | $this->setValueFunction($index,function($value) use($index,$name){ |
|
83 | $checkbox=new HtmlCheckbox($this->_getFieldIdentifier("ck"),"",$value); |
|
@@ 81-92 (lines=12) @@ | ||
78 | return $this; |
|
79 | } |
|
80 | ||
81 | public function fieldAsCheckbox($index,$name=NULL){ |
|
82 | $this->setValueFunction($index,function($value) use($index,$name){ |
|
83 | $checkbox=new HtmlCheckbox($this->_getFieldIdentifier("ck"),"",$value); |
|
84 | $checkbox->setChecked(JString::isBooleanTrue($value)); |
|
85 | if(isset($name)===false){ |
|
86 | $name=$this->_instanceViewer->getCaption($index)."[]"; |
|
87 | } |
|
88 | $checkbox->getField()->setProperty("name", $name); |
|
89 | return $checkbox; |
|
90 | }); |
|
91 | return $this; |
|
92 | } |
|
93 | ||
94 | public function fieldAsDropDown($index,$elements=[],$multiple=false,$name=NULL){ |
|
95 | $this->setValueFunction($index,function($value) use($index,$elements,$multiple,$name){ |