"; } /** * @return void */ public function endForm(): void { echo ""; } public function field($class, string $name, array $params = []) { if ($class === Select::class){ $this->fieldObject = SelectBuilder::build($name, $params); } elseif ($class === TextInput::class){ $this->fieldObject = TextInputBuilder::build($name, $params); } elseif ($class === TextArea::class){ $this->fieldObject = TextAreaBuilder::build($name, $params); } elseif ($class === Checkbox::class) { $this->fieldObject = CheckBoxBuilder::build($name, $params); } elseif ($class === Button::class) { $this->fieldObject = ButtonBuilder::build($name, $params); } elseif ($class === RadioButton::class){ $this->fieldObject = RadioButtonBuilder::build($name, $params); } elseif ($class === Hidden::class){ $this->fieldObject = HiddenBuilder::build($name, $params); } else { $this->fieldObject = new $class($name, $params); } return $this; } public function setLabel(string $title): self { $this->fieldObject->setLabel($title); return $this; } public function setOptions(array $options): self { $this->fieldObject->setOptions($options); return $this; } public function setTemplate($template): self { $this->fieldObject->setTemplate($template); return $this; } public function render() { $this->fieldObject->create(); $this->fieldObject->render(); } public function fetch() { $this->fieldObject->create(); return $this->fieldObject->fetch(); } }