N°8772 - Compiler: add dynamic bindings

This commit is contained in:
Eric Espie
2025-12-10 18:07:39 +01:00
parent 4d7183e067
commit 49ff9378aa
2 changed files with 43 additions and 1 deletions

View File

@@ -277,6 +277,7 @@ PHP,
<label>UI:ClassAttribute</label>
<value-type xsi:type="Combodo-ValueTypeClassAttribute">
<class>Contact</class>
<invalid-input>Test</invalid-input>
</value-type>
</node>
</nodes>
@@ -297,6 +298,43 @@ PHP,
'sMessage' => '',
],
'Input binding' => [
'sXMLContent' => <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<node id="input_binding_test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Combodo-PropertyTree" xsi:noNamespaceSchemaLocation = "https://www.combodo.com/itop-schema/3.3">
<nodes>
<node id="class_property" xsi:type="Combodo-Property">
<label>UI:Class</label>
<value-type xsi:type="Combodo-ValueTypeClass">
</value-type>
</node>
<node id="class_attribute_property" xsi:type="Combodo-Property">
<label>UI:ClassAttribute</label>
<value-type xsi:type="Combodo-ValueTypeClassAttribute">
<class>{{class_property.text}}</class>
</value-type>
</node>
</nodes>
</node>
XML,
'sExpectedPHP' => <<<PHP
class FormFor__input_binding_test extends Combodo\iTop\Forms\Block\Base\FormBlock
{
protected function BuildForm(): void
{
\$this->Add('class_property', 'Combodo\iTop\Forms\Block\Base\TextFormBlock', [
'label' => 'UI:Class',
]);
\$this->Add('class_attribute_property', 'Combodo\iTop\Forms\Block\DataModel\AttributeChoiceFormBlock', [
'label' => 'UI:ClassAttribute',
])
->InputDependsOn('class', 'class_property', 'text');
}
}
PHP,
'sMessage' => '',
],
'test' => [
'sXMLContent' => <<<XML
<?xml version="1.0" encoding="UTF-8"?>