sId = $oDomNode->getAttribute('id'); $this->sParentType = $oDomNode->GetChildText('extends', ''); $oDefinitionNode = $oDomNode->GetUniqueElement('definition'); $sDefinitionNodeType = $oDefinitionNode->getAttribute('xsi:type'); if (!is_a($sDefinitionNodeType, AbstractValueType::class, true)) { throw new PropertyTypeException('Unsupported type '.json_encode($sDefinitionNodeType).' in '); } $this->oValueType = new $sDefinitionNodeType(); $this->oValueType->SetRootId($this->sId); $this->oValueType->InitFromDomNode($oDefinitionNode); } public function ToPHPFormBlock(): string { $aPHPFragments = []; if ($this->oValueType->IsLeaf()) { $sLocalPHP = <<sId extends Combodo\iTop\Forms\Block\Base\FormBlock { protected function BuildForm(): void { PHP; $sLocalPHP .= "\n".$this->oValueType->ToPHPFormBlock($aPHPFragments); $sLocalPHP .= <<oValueType->ToPHPFormBlock($aPHPFragments); } return implode("\n\n", $aPHPFragments); } public function GetParentType(): string { return $this->sParentType; } }