N°8772 - compilation of choices from inputs

This commit is contained in:
Eric Espie
2025-12-16 11:03:52 +01:00
parent 2530d59e08
commit 75afd3ba46
8 changed files with 73 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ abstract class AbstractValueType
protected array $aInputs = [];
protected array $aOutputs = [];
protected array $aInputValues = [];
protected array $aDynamicInputValues = [];
protected array $aFormBlockOptionsForPHP = [];
public function InitFromDomNode(DesignElement $oDomNode): void
@@ -56,6 +57,11 @@ abstract class AbstractValueType
return $this->aInputs[$sInputName]->GetDataType();
}
public function GetDynamicInputValues(): array
{
return $this->aDynamicInputValues;
}
public function GetOutputs(): array
{
return $this->aOutputs;

View File

@@ -0,0 +1,33 @@
<?php
/*
* @copyright Copyright (C) 2010-2025 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\PropertyTree\ValueType;
use Combodo\iTop\DesignElement;
use Combodo\iTop\Forms\Block\Base\ChoiceFromInputsBlock;
use Combodo\iTop\PropertyTree\ValueType\AbstractValueType;
use utils;
class ValueTypeChoiceFromInput extends AbstractValueType
{
public function GetFormBlockClass(): string
{
return ChoiceFromInputsBlock::class;
}
public function InitFromDomNode(DesignElement $oDomNode): void
{
parent::InitFromDomNode($oDomNode);
foreach ($oDomNode->GetNodes('values/value') as $oValueNode) {
/** @var DesignElement $oValueNode */
$sValue = $oValueNode->GetAttribute('id');
$sLabel = $oValueNode->GetChildText('label');
$this->aDynamicInputValues[$sValue] = $sLabel;
}
}
}