formField = $formField; $this->fieldGeneralSettings = new FieldGeneralSettings($formField->getGeneralSettings()); $this->fieldAdvancedSettings = new FieldAdvancedSettings($formField->getAdvancedSettings()); } /** * Get the ID of the form to which this field belongs * * @return int The form ID. */ public function getFormId(): int { return $this->formField->getFormId(); } /** * Set the ID of the form to which this field belongs. * * @param int $formId The form ID to set. */ public function setFormId(int $formId): void { $this->formField->formId = $formId; } /** * Get ID of the form field. * * @return int The form field id. */ public function getId(): int { return $this->formField->getId(); } /** * Set the ID of the form field. * * @param int $id The ID to set. */ public function setId(int $id): void { $this->formField->id = $id; } /** * Get the index of the form field. * * @return int The index of the form field. */ public function getIndex(): int { return $this->formField->getIndex(); } /** * Set the index of the form field. * * @param int $index The index to set. */ public function setIndex(int $index): void { $this->formField->fieldIndex = $index; } /** * Get the type of the form field. * * @return string The type of the form field. */ public function getType(): string { return $this->formField->getType(); } /** * Set the type of the form field. * * @param string $type The type to set. */ public function setType(string $type): void { $this->formField->type = $type; } /** * Get the position of the form field. * * @return int The position of the form field. */ public function getPosition(): int { return $this->formField->getPosition(); } /** * Set the position of the form field. * * @param int $position The position to set. */ public function setPosition(int $position): void { $this->formField->position = $position; } /** * Get the parent field ID. * * @return int|null The parent field ID. */ public function getParentId(): ?int { return $this->formField->getParentId(); } /** * Set the parent field ID. * * @param int|null $parentId The parent field ID to set. */ public function setParentId(?int $parentId): void { $this->formField->parentId = $parentId; } /** * Check if the confirm field feature is enabled. * * @return bool True if the confirm field feature is enabled, false otherwise. */ public function isConfirmFieldEnabled(): bool { return $this->formField->isConfirmFieldEnabled(); } /** * Get the label for the confirm field field. * * @return string The label for the confirm field field. */ public function getConfirmFieldLabel(): string { return $this->formField->getConfirmFieldLabel(); } /** * Get the placeholder for the confirm field field. * * @return string The placeholder for the confirm field field. */ public function getConfirmFieldPlaceholder(): string { return $this->formField->getConfirmFieldPlaceholder(); } /** * Check if the confirm field label should be hidden. * * @return bool True if the confirm label should be hidden, false otherwise. */ public function isConfirmFieldHideLabel(): bool { return $this->formField->isConfirmFieldHideLabel(); } /** * Set the enabled status of the confirm field feature. * * @param bool $enabled The enabled status to set. */ public function setConfirmFieldEnabled(bool $enabled): void { $this->formField->setConfirmFieldEnabled($enabled); } /** * Set the label for the confirm field. * * @param string $label The label to set. */ public function setConfirmFieldLabel(string $label): void { $this->formField->setConfirmFieldLabel($label); } /** * Set the placeholder for the confirm field. * * @param string $ph The placeholder to set. */ public function setConfirmFieldPlaceholder(string $ph): void { $this->formField->setConfirmFieldPlaceholder($ph); } /** * Set the hideLabel setting for the confirm field. * * @param bool $hide The hideLabel setting to set. */ public function setConfirmFieldHideLabel(bool $hide): void { $this->formField->setConfirmFieldHideLabel($hide); } /** * Set the number of rows (for textarea fields). * * @param int $rows */ public function setRows(int $rows): void { $this->formField->setRows($rows); } /** * Get the FieldGeneralSettings entity. */ public function getFieldGeneralSettings(): FieldGeneralSettings { return $this->fieldGeneralSettings; } /** * Get the FieldAdvancedSettings entity. */ public function getFieldAdvancedSettings(): FieldAdvancedSettings { return $this->fieldAdvancedSettings; } /** * Convert the form field entity to an array. * * @return array The form field entity as an array. */ public function toArray(): array { return array_merge( [ 'id' => $this->getId(), 'formId' => $this->getFormId(), 'fieldIndex' => $this->getIndex(), 'type' => $this->getType(), 'position' => $this->getPosition(), 'parentId' => $this->getParentId(), 'rows' => $this->formField->getRows(), 'confirmFieldEnabled' => $this->isConfirmFieldEnabled(), 'confirmFieldLabel' => $this->getConfirmFieldLabel(), 'confirmFieldPlaceholder' => $this->getConfirmFieldPlaceholder(), 'confirmFieldHideLabel' => $this->isConfirmFieldHideLabel(), ], $this->getFieldGeneralSettings()->toArray(), $this->getFieldAdvancedSettings()->toArray() ); } }