mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°8771 - Add Symfony form component to iTop core
- IO debug
This commit is contained in:
@@ -153,6 +153,11 @@ abstract class AbstractFormBlock
|
||||
return $this->aFormOutputs[$sName];
|
||||
}
|
||||
|
||||
public function GetOutputs(): array
|
||||
{
|
||||
return $this->aFormOutputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach an input to a block output.
|
||||
*
|
||||
|
||||
@@ -15,7 +15,7 @@ class FormOutput
|
||||
private string $sType;
|
||||
|
||||
private null|AbstractOutputConverter $oConverter;
|
||||
private array $aValues;
|
||||
private ?array $aValues = null;
|
||||
|
||||
public function __construct(string $sName, string $sType, AbstractOutputConverter $oConverter = null)
|
||||
{
|
||||
@@ -62,5 +62,13 @@ class FormOutput
|
||||
return $this->aValues[$sEventType] ?? null;
|
||||
}
|
||||
|
||||
public function HasValues(): bool
|
||||
{
|
||||
return $this->aValues !== null;
|
||||
}
|
||||
|
||||
public function GetValues(): array
|
||||
{
|
||||
return $this->aValues;
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,9 @@ class AttributeIOFormat
|
||||
{
|
||||
// validation du format sinon exception
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->sAttributeName;
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,9 @@ class ClassIOFormat
|
||||
{
|
||||
// validation du format sinon exception
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->sClassName;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FormTypeExtension extends AbstractTypeExtension
|
||||
@@ -39,5 +41,12 @@ class FormTypeExtension extends AbstractTypeExtension
|
||||
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
if(array_key_exists('form_block', $options)) {
|
||||
$view->vars['form_block'] = $options['form_block'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,17 @@
|
||||
{{- parent() -}}
|
||||
{%- endblock form_row -%}
|
||||
|
||||
{%- block form_widget -%}
|
||||
{{- parent() -}}
|
||||
{% if form_block is defined %}
|
||||
{% for output in form_block.GetOutputs() %}
|
||||
{% if output.HasValues %}<span style="background-color:#dac2e3;border-radius: 8px;padding: 1px 4px;font-size: .9rem;margin-right: 3px;"><b>{{ output.name }}</b> {% for t,v in output.GetValues %} {{ t }} = {{ v }} {% endfor %} {% endif %}</span>
|
||||
{% else %}
|
||||
Aucun output
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{%- endblock form_widget -%}
|
||||
|
||||
{%- block form_errors -%}
|
||||
<div class="form-error">
|
||||
{{- parent() -}}
|
||||
|
||||
Reference in New Issue
Block a user