N°8772 - Form turbo stream WIP

This commit is contained in:
Eric Espie
2025-10-28 16:41:59 +01:00
parent 2a3de68652
commit 8134d9a592
2 changed files with 18 additions and 24 deletions

View File

@@ -100,6 +100,7 @@ abstract class AbstractFormBlock
public function AddSubFormBlock(AbstractFormBlock $oSubFormBlock): AbstractFormBlock
{
$this->aSubFormBlocks[] = $oSubFormBlock;
return $this;
}
@@ -136,8 +137,8 @@ abstract class AbstractFormBlock
*/
public function GetInput(string $sName): FormInput
{
if(!array_key_exists($sName, $this->aFormInputs)) {
throw new FormBlockException('Missing input ' . $sName . ' for ' . $this->sName);
if (!array_key_exists($sName, $this->aFormInputs)) {
throw new FormBlockException('Missing input '.$sName.' for '.$this->sName);
}
return $this->aFormInputs[$sName];
@@ -166,8 +167,8 @@ abstract class AbstractFormBlock
*/
public function GetOutput(string $sName): FormOutput
{
if(!array_key_exists($sName, $this->aFormOutputs)) {
throw new FormBlockException('Missing ouput ' . $sName . ' for ' . $this->sName);
if (!array_key_exists($sName, $this->aFormOutputs)) {
throw new FormBlockException('Missing ouput '.$sName.' for '.$this->sName);
}
return $this->aFormOutputs[$sName];
@@ -213,6 +214,7 @@ abstract class AbstractFormBlock
return true;
}
}
return false;
}
@@ -226,6 +228,7 @@ abstract class AbstractFormBlock
$aBindings[$oFormInput->GetName()] = $oFormInput->GetBinding();
}
}
return $aBindings;
}
@@ -233,7 +236,7 @@ abstract class AbstractFormBlock
{
foreach ($this->aFormInputs as $oFormInput) {
if ($oFormInput->IsBound()) {
if(!$oFormInput->IsDataReady($sEventType)) {
if (!$oFormInput->IsDataReady($sEventType)) {
return false;
}
}
@@ -252,6 +255,16 @@ abstract class AbstractFormBlock
$this->bIsAdded = $bIsAdded;
}
public function ListBlockNames(): array
{
$aNames = [];
foreach ($this->aSubFormBlocks as $oSubFormBlock) {
$aNames[] = $oSubFormBlock->GetName();
}
return $aNames;
}
/**
* Return the form type.
*