SetOption('multiple', true); $oOptionsRegister->SetOptionArrayValue('attr', 'size', 5); $oOptionsRegister->SetOptionArrayValue('attr', 'style', 'height: auto;'); } /** @inheritdoc */ protected function RegisterIO(IORegister $oIORegister): void { parent::RegisterIO($oIORegister); $oIORegister->AddInput(self::INPUT_CLASS_NAME, ClassIOFormat::class); $oIORegister->AddInput(self::INPUT_ATTRIBUTE, AttributeIOFormat::class); $oIORegister->AddOutput(self::OUTPUT_VALUE, RawFormat::class); } /** @inheritdoc * @throws \Combodo\iTop\Forms\Block\FormBlockException */ public function UpdateOptions(OptionsRegister $oOptionsRegister): void { parent::UpdateOptions($oOptionsRegister); $sClass = strval($this->GetInputValue(self::INPUT_CLASS_NAME)); $sAttCode = strval($this->GetInputValue(self::INPUT_ATTRIBUTE)); try { /** @var \ModelReflection $oModelReflection */ $oModelReflection = DIService::GetInstance()->GetService('ModelReflection'); $aValues = $oModelReflection->GetAllowedValues_att($sClass, $sAttCode); $oOptionsRegister->SetOption('choices', array_flip($aValues ?? [])); } catch (Exception $e) { throw new FormBlockException('Update option failed for '.json_encode($this->GetName()), 0, $e); } } }