Skip to content

Commit

Permalink
EZP-29119: Display proper validation error message when non-image fil…
Browse files Browse the repository at this point in the history
…e uploaded in image FieldType
  • Loading branch information
mikadamczyk committed Jun 13, 2018
1 parent e76fd81 commit 29610b8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/bundle/Resources/views/content/form_fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,36 @@

{# general content editing theming #}

{% block form_label -%}
{% if label is not same as(false) -%}
{%- if compound is defined and compound -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%}
{%- else -%}
{%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%}
{%- endif -%}
{% if required -%}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %}
{%- endif -%}
{% if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{% set label = name|humanize %}
{%- 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) }}</{{ element|default('label') }}>
{%- else -%}
{%- if errors|length > 0 -%}
<div id="{{ id }}_errors" class="mb-2">
{{- form_errors(form) -}}
</div>
{%- endif -%}
{%- endif -%}
{%- endblock form_label %}

{%- block form_errors -%}
{%- if errors|length > 0 -%}
{%- for error in errors -%}
Expand Down

0 comments on commit 29610b8

Please sign in to comment.