update 2
This commit is contained in:
parent
bd456e6331
commit
906a8fd739
@ -159,7 +159,8 @@ $form = new ActiveForm()
|
||||
|
||||
$form->field(TextArea::class, name: "phone", params: ['class' => "form-control", 'placeholder' => 'phone', 'value'=> 'asd'])->setTemplate(\itguild\forms\templates\bootstrap5\Bootstrap5Template::class)->setLabel("Message")->render();
|
||||
$form->field(class: Select::class, name: 'select2', params: ['value' => 2])
|
||||
->setOptions(['1' => 'bbb1', '2' => 'vvv3', 3 => 'ggg3', 4 => 'fgfgfgfg4'])->render();
|
||||
->setOptions(['1' => 'bbb1', 2 => 'vvv3', 3 => 'ggg3', 4 => 'fgfgfgfg4'])
|
||||
->render();
|
||||
|
||||
|
||||
?>
|
||||
|
@ -14,6 +14,7 @@ class ActiveForm
|
||||
{
|
||||
private BaseInput $fieldObject;
|
||||
|
||||
|
||||
/**
|
||||
* @param string $action
|
||||
* @return void
|
||||
@ -37,7 +38,7 @@ class ActiveForm
|
||||
if ($class === Select::class){
|
||||
$this->fieldObject = SelectBuilder::build($name, $params);
|
||||
}
|
||||
if ($class === TextArea::class){
|
||||
elseif ($class === TextArea::class){
|
||||
$this->fieldObject = TextAreaBuilder::build($name, $params);
|
||||
}
|
||||
else {
|
||||
|
@ -51,7 +51,7 @@ class Select extends BaseInput
|
||||
if($this->hasLabel == true) {
|
||||
$label = "<label>$this->labelTitle</label>";
|
||||
}
|
||||
$this->html = str_replace('{select}', $select, $this->selectTemplate->getSelectTemplate());
|
||||
$this->html = str_replace('{input}', $select, $this->selectTemplate->getInputTemplate());
|
||||
$this->html = str_replace('{label}', $label, $this->html);
|
||||
|
||||
return $this;
|
||||
@ -90,6 +90,7 @@ class Select extends BaseInput
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = array_merge($options, $this->options);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user