mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-18 16:18:47 +02:00
N°8772 - Form dependencies manager implementation - WIP
This commit is contained in:
@@ -32,9 +32,10 @@ abstract class AbstractFormBlock
|
||||
return $this->aOptions;
|
||||
}
|
||||
|
||||
public function AddSubFormBlock(AbstractFormBlock $oSubFormBlock): void
|
||||
public function AddSubFormBlock(AbstractFormBlock $oSubFormBlock): AbstractFormBlock
|
||||
{
|
||||
$this->aSubFormBlocks[] = $oSubFormBlock;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function GetSubFormBlocks(): array
|
||||
@@ -57,11 +58,40 @@ abstract class AbstractFormBlock
|
||||
$this->aFormOutputs[$oFormOutput->GetName()] = $oFormOutput;
|
||||
}
|
||||
|
||||
public function GetOutput(string $sName): FormOutput
|
||||
public function GetOutput(string $sName): ?FormOutput
|
||||
{
|
||||
return $this->aFormOutputs[$sName];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sInputName
|
||||
* @param string $sOutputBlockName
|
||||
* @param string $sOutputName
|
||||
*
|
||||
* @return $this
|
||||
* @throws \Combodo\iTop\Forms\Block\FormsBlockException
|
||||
*/
|
||||
public function DependsOn(string $sInputName, string $sOutputBlockName, string $sOutputName): AbstractFormBlock
|
||||
{
|
||||
$oFormInput = $this->GetInput($sInputName);
|
||||
if (is_null($oFormInput)) {
|
||||
throw new FormsBlockException('Missing input ' . $sInputName . ' for ' . $this->sName);
|
||||
}
|
||||
$oFormInput->Connect($sOutputBlockName, $sOutputName);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function HasConnections(): bool
|
||||
{
|
||||
foreach ($this->aFormInputs as $oFormInput) {
|
||||
if ($oFormInput->HasConnections()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
abstract public function GetFormType(): string;
|
||||
|
||||
abstract public function InitInputs(): void;
|
||||
|
||||
Reference in New Issue
Block a user