N°8772 - Sub-forms WIP

This commit is contained in:
Eric Espie
2025-10-24 16:56:45 +02:00
parent 675db85131
commit c2fcf4144b
9 changed files with 73 additions and 72 deletions

View File

@@ -53,8 +53,11 @@ abstract class AbstractFormBlock
$this->InitInputs();
$this->InitOutputs();
$this->aOptions = array_merge($this->aOptions, $this->InitOptions());
$this->BuildForm();
}
abstract protected function BuildForm();
/**
* Return the form block name.
*
@@ -65,6 +68,17 @@ abstract class AbstractFormBlock
return $this->sName;
}
/**
* Return the form block options.
* Options will be passed to FormType for building.
*
* @return array
*/
public function GetOptions(): array
{
return $this->aOptions;
}
/**
* Return the form block options.
* Options will be passed to FormType for building.
@@ -183,6 +197,15 @@ abstract class AbstractFormBlock
return $this;
}
public function DependsOnParent(string $sInputName, FormBlock $oParentBlock, string $sParentInputName): AbstractFormBlock
{
$oFormInput = $this->GetInput($sInputName);
$oParentFormInput = $oParentBlock->GetInput($sParentInputName);
$oFormInput->Bind($oParentFormInput);
return $this;
}
public function HasConnections(): bool
{
foreach ($this->aFormInputs as $oFormInput) {