Make sure we always render errors. Eventhough labels are disabled
This commit is contained in:
parent
866a1429b7
commit
d8f3de91d5
@ -204,6 +204,12 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}{{- form_errors(form) -}}</{{ element|default('label') }}>
|
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}{{- form_errors(form) -}}</{{ element|default('label') }}>
|
||||||
|
{%- else -%}
|
||||||
|
{%- if errors|length > 0 -%}
|
||||||
|
<div id="{{ id }}_errors" class="mb-2">
|
||||||
|
{{- form_errors(form) -}}
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endblock form_label %}
|
{%- endblock form_label %}
|
||||||
|
|
||||||
|
@ -182,6 +182,16 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testErrorWithNoLabel()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('label'=>false));
|
||||||
|
$form->addError(new FormError('[trans]Error 1[/trans]'));
|
||||||
|
$view = $form->createView();
|
||||||
|
$html = $this->renderLabel($view);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html, '//span[.="[trans]Error[/trans]"]');
|
||||||
|
}
|
||||||
|
|
||||||
public function testCheckedCheckbox()
|
public function testCheckedCheckbox()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', true);
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', true);
|
||||||
|
Reference in New Issue
Block a user