5, 'style' => 'height: auto;' ]; return $aOptions; } /** @inheritdoc */ public function InitInputs(): void { parent::InitInputs(); $this->AddInput(self::INPUT_CLASS_NAME, ClassIOFormat::class); $this->AddInput(self::INPUT_ATTRIBUTE, AttributeIOFormat::class); } /** @inheritdoc */ public function InitOutputs(): void { parent::InitOutputs(); $this->AddOutput(self::OUTPUT_VALUE, RawFormat::class); } /** @inheritdoc * @throws FormBlockException * @throws Exception */ public function AllowAdd(): bool { $bDependentOk = $this->GetInput(self::INPUT_CLASS_NAME)->Value() != '' && $this->GetInput(self::INPUT_ATTRIBUTE)->Value() != ''; if($bDependentOk) { $oAttDef = MetaModel::GetAttributeDef($this->GetInput(self::INPUT_CLASS_NAME)->Value()->__toString(), $this->GetInput(self::INPUT_ATTRIBUTE)->Value()->__toString()); $aValues = $oAttDef->GetAllowedValues(); return $aValues != null; } else{ return false; } } /** @inheritdoc * @throws Exception */ public function UpdateOptions(): array { $aOptions = parent::GetOptions(); $oClassName = $this->GetInput(self::INPUT_CLASS_NAME)->Value(); if($oClassName == '') return $aOptions; $oAttribute = $this->GetInput(self::INPUT_ATTRIBUTE)->Value(); if($oAttribute == '') return $aOptions; $oAttDef = MetaModel::GetAttributeDef(strval($oClassName), strval($oAttribute)); $aValues = $oAttDef->GetAllowedValues(); if($aValues === null) return $aOptions; $aOptions['choices'] = array_flip($aValues); return $aOptions; } }