{# templates/admin/field/jante_photo.html.twig #} {# Read custom options via getCustomOption() to avoid accessing internal KeyValueStore properties #} {%- set public_base = field.getCustomOption('public_base') ?: '' -%} {%- set bucket = field.getCustomOption('bucket') ?: '' -%} {%- set path = field.value is defined and field.value is not empty ? field.value|url_encode : '' -%} {%- if public_base and bucket and path -%} {%- set url = public_base ~ '/storage/v1/object/public/' ~ bucket ~ '/' ~ path -%} {%- else -%} {%- set url = '' -%} {%- endif -%}
{% if url is not empty %} {{ entity.instance.altText|default('')|e('html_attr') }} {% else %} Aucune image {% endif %}