mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 17:48:43 +02:00
N°8771 - Add Symfony form component to iTop core
- IO debug
This commit is contained in:
@@ -23,9 +23,15 @@ class AttributeValueChoiceFormBlock extends ChoiceFormBlock
|
||||
public const INPUT_ATTRIBUTE = 'attribute';
|
||||
|
||||
/** @inheritdoc */
|
||||
public function InitOptions(array &$aOptions = []): void
|
||||
public function InitOptions(array &$aOptions = []): array
|
||||
{
|
||||
$aOptions['multiple'] = true;
|
||||
$aOptions['attr'] = [
|
||||
'size' => 10,
|
||||
'style' => 'height: auto;'
|
||||
];
|
||||
|
||||
return $aOptions;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@@ -36,4 +42,22 @@ class AttributeValueChoiceFormBlock extends ChoiceFormBlock
|
||||
$this->AddInput(new FormInput(self::INPUT_ATTRIBUTE, AttributeIOFormat::class));
|
||||
}
|
||||
|
||||
public function GetOptions(): array
|
||||
{
|
||||
$aOptions = parent::GetOptions();
|
||||
|
||||
$oBindingClassName = $this->GetInput(self::INPUT_CLASS_NAME)->GetBinding();
|
||||
$oClassName = $oBindingClassName->oOutput->Value();
|
||||
|
||||
$oBindingAttribute = $this->GetInput(self::INPUT_ATTRIBUTE)->GetBinding();
|
||||
$oAttribute = $oBindingAttribute->oOutput->Value();
|
||||
|
||||
$oAttDef = \MetaModel::GetAttributeDef(strval($oClassName), strval($oAttribute));
|
||||
$aValues = $oAttDef->GetAllowedValues();
|
||||
|
||||
$aOptions['choices'] = array_flip($aValues);
|
||||
|
||||
return $aOptions;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user