Skip to content

Commit

Permalink
Merge pull request #172 from clash82/EZP-24717
Browse files Browse the repository at this point in the history
EZP-24717: Image alt attribute should not be shown when empty
  • Loading branch information
andrerom committed Aug 26, 2015
2 parents b3159c5 + 4be434d commit 420d76b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Resources/views/fields/ezimage_simple.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
#}
{% block ezimage_field %}
{% if not ez_is_field_empty( content, field ) %}
{% set image_alt = parameters.alt|default( field.value.alternativeText ) %}
{% set image_alias = ez_image_alias( field, versionInfo, parameters.alias|default( 'original' ) ) %}
{# if image alias is not found, null is returned, an error is added in logs and the image is not displayed #}
{% if image_alias %}
<img src="{{ asset( image_alias.uri ) }}"{% if imageAlias.width is defined %} width="{{ image_alias.width }}"{% endif %}{% if imageAlias.height is defined %} height="{{ image_alias.height }}"{% endif %} alt="{{ parameters.alt|default( field.value.alternativeText ) }}" class="img-responsive" />
<img src="{{ asset( image_alias.uri ) }}"{% if imageAlias.width is defined %} width="{{ image_alias.width }}"{% endif %}{% if imageAlias.height is defined %} height="{{ image_alias.height }}"{% endif %}{% if image_alt is not empty %} alt="{{ image_alt }}"{% endif %} class="img-responsive" />
{% endif %}
{% endif %}
{% endblock %}

0 comments on commit 420d76b

Please sign in to comment.