Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bee0888

Browse files
committed
bug EasyCorp#2525 Don't show broken images for optional images (javiereguiluz)
This PR was squashed before being merged into the 2.0.x-dev branch (closes EasyCorp#2525). Discussion ---------- Don't show broken images for optional images This fixes EasyCorp#2520. Commits ------- fb61f6c Don't show broken images for optional images
2 parents a94db0a + fb61f6c commit bee0888

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
<a href="#" class="easyadmin-thumbnail" data-featherlight="#easyadmin-lightbox-{{ uuid }}" data-featherlight-close-on-click="anywhere">
2-
<img src="{{ asset(value) }}">
3-
</a>
1+
{# this check is needed because image fields can be optional #}
2+
{% if value is empty or value == (field_options.base_path|default(''))|trim('/', side='right') ~ '/' %}
3+
{{ include(entity_config.templates.label_empty) }}
4+
{% else %}
5+
<a href="#" class="easyadmin-thumbnail" data-featherlight="#easyadmin-lightbox-{{ uuid }}" data-featherlight-close-on-click="anywhere">
6+
<img src="{{ asset(value) }}">
7+
</a>
48

5-
<div id="easyadmin-lightbox-{{ uuid }}" class="easyadmin-lightbox">
6-
<img src="{{ asset(value) }}">
7-
</div>
9+
<div id="easyadmin-lightbox-{{ uuid }}" class="easyadmin-lightbox">
10+
<img src="{{ asset(value) }}">
11+
</div>
12+
{% endif %}

0 commit comments

Comments
 (0)