This commit is contained in:
jf-cbd
2025-11-04 17:02:56 +01:00
parent a092b65be7
commit 4f4ba7167d
4 changed files with 34 additions and 13 deletions

View File

@@ -109,6 +109,11 @@ abstract class AbstractFormBlock implements IFormBlock
return $this->oParent;
}
public function HasParent(): bool
{
return $this->oParent !== null;
}
/**
* Return the form block name.
*
@@ -128,6 +133,19 @@ abstract class AbstractFormBlock implements IFormBlock
return $sParentName.'_'.$this->sName;
}
public function GetPath(): array
{
$aPath = [];
$oCurrent = $this;
do {
$aPath[] = $oCurrent->GetName();
$oCurrent = $oCurrent->getParent();
} while ($oCurrent->HasParent());
return array_reverse($aPath);
}
/**
* Return the form block options.
* Options will be passed to FormType for building.