N°8771 - Add Symfony form component to iTop core

- IO debug
This commit is contained in:
Benjamin Dalsass
2025-10-24 14:46:59 +02:00
parent 33c03f9493
commit eb3c5e4eee
16 changed files with 273 additions and 260 deletions

View File

@@ -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;
}
}