mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°8772 - test driven compiler wip
This commit is contained in:
@@ -7,9 +7,39 @@
|
||||
|
||||
namespace Combodo\iTop\PropertyTree;
|
||||
|
||||
use Combodo\iTop\DesignElement;
|
||||
use Combodo\iTop\PropertyTree\ValueType\ValueTypeFactory;
|
||||
|
||||
/**
|
||||
* @since 3.3.0
|
||||
*/
|
||||
class Property extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* @param \Combodo\iTop\DesignElement $oDomNode
|
||||
*
|
||||
* @return void
|
||||
* @throws \Combodo\iTop\PropertyTree\PropertyTreeException
|
||||
* @throws \DOMFormatException
|
||||
*/
|
||||
public function InitFromDomNode(DesignElement $oDomNode): void
|
||||
{
|
||||
parent::InitFromDomNode($oDomNode);
|
||||
|
||||
$oValueTypeNode = $oDomNode->GetOptionalElement('value-type');
|
||||
if ($oValueTypeNode) {
|
||||
$this->oValueType = ValueTypeFactory::GetInstance()->CreateValueTypeFromDomNode($oValueTypeNode);
|
||||
}
|
||||
}
|
||||
|
||||
public function ToPHP(&$aPHPFragments = []): string
|
||||
{
|
||||
$sFormBlockClass = $this->oValueType->GetFormBlockClass();
|
||||
return <<<PHP
|
||||
\$this->Add('$this->sId', '$sFormBlockClass', [
|
||||
'label' => '$this->sLabel',
|
||||
]);
|
||||
|
||||
PHP;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user