mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 22:48:45 +02:00
N°8772 - compilation of choices values
This commit is contained in:
@@ -22,6 +22,7 @@ abstract class AbstractValueType
|
||||
protected array $aInputs = [];
|
||||
protected array $aOutputs = [];
|
||||
protected array $aInputValues = [];
|
||||
protected array $aFormBlockOptionsForPHP = [];
|
||||
|
||||
public function InitFromDomNode(DesignElement $oDomNode): void
|
||||
{
|
||||
@@ -40,6 +41,11 @@ abstract class AbstractValueType
|
||||
}
|
||||
}
|
||||
|
||||
public function GetFormBlockOptions(): array
|
||||
{
|
||||
return $this->aFormBlockOptionsForPHP;
|
||||
}
|
||||
|
||||
public function GetInputValues(): array
|
||||
{
|
||||
return $this->aInputValues;
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
|
||||
namespace Combodo\iTop\PropertyTree\ValueType;
|
||||
|
||||
use Combodo\iTop\DesignElement;
|
||||
use Combodo\iTop\Forms\Block\Base\ChoiceFormBlock;
|
||||
use Combodo\iTop\Forms\Block\Base\FormBlock;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* @since 3.3.0
|
||||
@@ -19,4 +20,23 @@ class ValueTypeChoice extends AbstractValueType
|
||||
{
|
||||
return ChoiceFormBlock::class;
|
||||
}
|
||||
|
||||
public function InitFromDomNode(DesignElement $oDomNode): void
|
||||
{
|
||||
parent::InitFromDomNode($oDomNode);
|
||||
|
||||
$sChoices = "[\n";
|
||||
foreach ($oDomNode->GetNodes('values/value') as $oValueNode) {
|
||||
/** @var DesignElement $oValueNode */
|
||||
$sValue = utils::QuoteForPHP($oValueNode->GetAttribute('id'));
|
||||
$sLabel = utils::QuoteForPHP($oValueNode->GetChildText('label'));
|
||||
$sChoices .= <<<PHP
|
||||
\Dict::S($sLabel) => $sValue,
|
||||
|
||||
PHP;
|
||||
}
|
||||
$sChoices .= "\t\t\t]";
|
||||
|
||||
$this->aFormBlockOptionsForPHP['choices'] = $sChoices;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user