From 2c3a777d608e00b573c108510e6bbd3d8afbfe88 Mon Sep 17 00:00:00 2001 From: Eugene Karuna Date: Mon, 19 May 2025 17:26:36 +0200 Subject: [PATCH] Add location_country field to events.yaml and update addressCountry in show.antlers.html - Introduced a new field `location_country` in events.yaml to capture the two-letter ISO country code. - Updated the `addressCountry` in show.antlers.html to dynamically use the `location_country` value or fallback to the site's short locale. --- .../blueprints/collections/events/events.yaml | 22 +++++++++++++++++++ .../resources/views/events/show.antlers.html | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/resources/presets/events/resources/blueprints/collections/events/events.yaml b/resources/presets/events/resources/blueprints/collections/events/events.yaml index 2302420..02caad8 100644 --- a/resources/presets/events/resources/blueprints/collections/events/events.yaml +++ b/resources/presets/events/resources/blueprints/collections/events/events.yaml @@ -179,6 +179,28 @@ tabs: - sometimes if: {{ singular_handle }}_type: 'equals offline' + - + handle: location_country + field: + input_type: text + antlers: false + display: Country + type: text + icon: text + listable: hidden + instructions_position: above + visibility: visible + always_save: false + width: 50 + instructions: 'Enter the two-letter ISO country code (e.g., NL, US, GB). If left empty, the site locale will be used.' + placeholder: 'e.g., NL' + validate: + - sometimes + - max:2 + - min:2 + - alpha + if: + {{ singular_handle }}_type: 'equals offline' - handle: {{ singular_handle }}_url field: diff --git a/resources/presets/events/resources/views/events/show.antlers.html b/resources/presets/events/resources/views/events/show.antlers.html index 909dbfc..67c9514 100644 --- a/resources/presets/events/resources/views/events/show.antlers.html +++ b/resources/presets/events/resources/views/events/show.antlers.html @@ -21,7 +21,7 @@ "@type": "PostalAddress", "streetAddress": "{{ location_address }}", "addressLocality": "{{ location_locality }}", - "addressCountry": "NL" + "addressCountry": "{{ location_country | upper ?? site:short_locale | upper }}" } }, {{ elseif {{ singular_handle }}_type.value == 'online' }}