{%- set public_base = supabase_public_url|default('')|trim('/') -%} {%- set bucket = supabase_storage_bucket|default('')|trim('/') -%} {%- set raw_path = field.value is defined and field.value is not empty ? field.value : (entity is defined and entity.instance is defined and entity.instance is not null and entity.instance.storagePath is defined ? entity.instance.storagePath : '') -%} {%- set mode = field.getCustomOption('mode') ?: 'index' -%} {%- if public_base and bucket and raw_path -%} {%- set segments = raw_path|split('/') -%} {%- set encoded_segments = [] -%} {%- for segment in segments -%} {%- set encoded_segments = encoded_segments|merge([segment|url_encode]) -%} {%- endfor -%} {%- set url = public_base ~ '/storage/v1/object/public/' ~ bucket ~ '/' ~ encoded_segments|join('/') -%} {%- else -%} {%- set url = '' -%} {%- endif -%} {%- set jante_reference = (entity is defined and entity.instance is defined and entity.instance is not null and entity.instance.jante is not null and entity.instance.jante.reference is defined) ? entity.instance.jante.reference : 'Jante' -%} {%- set alt_text = 'Visuel 2D de ' ~ jante_reference -%}