SDK Form demonstrator fix recursive field hiding

This commit is contained in:
Eric Espie
2025-04-17 17:49:33 +02:00
parent c522763412
commit a4da05efee
2 changed files with 6 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ class DependencyNode implements \Iterator
{
$aResult = [];
foreach ($this as $oChildNode) {
$aResult = array_merge($aResult, $oChildNode->GetSubNodes());
$aResult = array_merge($aResult, [$oChildNode], $oChildNode->GetSubNodes());
}
return $aResult;

View File

@@ -32,6 +32,10 @@ class FormBuilder implements FormBuilderInterface, \IteratorAggregate
{
$this->oDependencies = new DependencyGraph();
$this->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
$this->Finalize();
});
$this->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
$this->aModelData = [];
});
@@ -72,6 +76,7 @@ class FormBuilder implements FormBuilderInterface, \IteratorAggregate
private function HideField(FormInterface $oForm, string $sName): void
{
\IssueLog::Info("Hiding field $sName");
$oForm->add($sName, HiddenType::class, ['mapped' => false]);
}