mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
SDK Form demonstrator fix recursive field hiding
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user