mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
N°8772 - Form turbo stream WIP
This commit is contained in:
@@ -100,6 +100,7 @@ abstract class AbstractFormBlock
|
||||
public function AddSubFormBlock(AbstractFormBlock $oSubFormBlock): AbstractFormBlock
|
||||
{
|
||||
$this->aSubFormBlocks[] = $oSubFormBlock;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -136,8 +137,8 @@ abstract class AbstractFormBlock
|
||||
*/
|
||||
public function GetInput(string $sName): FormInput
|
||||
{
|
||||
if(!array_key_exists($sName, $this->aFormInputs)) {
|
||||
throw new FormBlockException('Missing input ' . $sName . ' for ' . $this->sName);
|
||||
if (!array_key_exists($sName, $this->aFormInputs)) {
|
||||
throw new FormBlockException('Missing input '.$sName.' for '.$this->sName);
|
||||
}
|
||||
|
||||
return $this->aFormInputs[$sName];
|
||||
@@ -166,8 +167,8 @@ abstract class AbstractFormBlock
|
||||
*/
|
||||
public function GetOutput(string $sName): FormOutput
|
||||
{
|
||||
if(!array_key_exists($sName, $this->aFormOutputs)) {
|
||||
throw new FormBlockException('Missing ouput ' . $sName . ' for ' . $this->sName);
|
||||
if (!array_key_exists($sName, $this->aFormOutputs)) {
|
||||
throw new FormBlockException('Missing ouput '.$sName.' for '.$this->sName);
|
||||
}
|
||||
|
||||
return $this->aFormOutputs[$sName];
|
||||
@@ -213,6 +214,7 @@ abstract class AbstractFormBlock
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -226,6 +228,7 @@ abstract class AbstractFormBlock
|
||||
$aBindings[$oFormInput->GetName()] = $oFormInput->GetBinding();
|
||||
}
|
||||
}
|
||||
|
||||
return $aBindings;
|
||||
}
|
||||
|
||||
@@ -233,7 +236,7 @@ abstract class AbstractFormBlock
|
||||
{
|
||||
foreach ($this->aFormInputs as $oFormInput) {
|
||||
if ($oFormInput->IsBound()) {
|
||||
if(!$oFormInput->IsDataReady($sEventType)) {
|
||||
if (!$oFormInput->IsDataReady($sEventType)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -252,6 +255,16 @@ abstract class AbstractFormBlock
|
||||
$this->bIsAdded = $bIsAdded;
|
||||
}
|
||||
|
||||
public function ListBlockNames(): array
|
||||
{
|
||||
$aNames = [];
|
||||
foreach ($this->aSubFormBlocks as $oSubFormBlock) {
|
||||
$aNames[] = $oSubFormBlock->GetName();
|
||||
}
|
||||
|
||||
return $aNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the form type.
|
||||
*
|
||||
|
||||
@@ -21,25 +21,6 @@
|
||||
{%- block form_row -%}
|
||||
{% set row_attr = row_attr|merge({class: (row_attr.class|default('') ~ ' ibo-field ibo-content-block ibo-block ibo-field-small')|trim}) %}
|
||||
{{- parent() -}}
|
||||
|
||||
{% if form_block is defined %}
|
||||
{% for output in form_block.GetOutputs() %}
|
||||
<ul>
|
||||
{% if output.HasValues %}
|
||||
<li style="background-color:#dac2e3;border-radius: 8px;padding: 1px 4px;font-size: 1rem;margin: 5px 0;">
|
||||
<div>
|
||||
<div><b>{{ output.name }}</b></div>
|
||||
{% for t,v in output.GetValues %}
|
||||
<div>- {{ t }}: {{ v }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% else %}
|
||||
Aucun output
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{%- endblock form_row -%}
|
||||
|
||||
{%- block form_errors -%}
|
||||
|
||||
Reference in New Issue
Block a user