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, true); } /** * @inheritdoc * * @throws 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 = ServiceLocator::GetInstance()->get('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); } } }