Skip to content

Commit ef6ca40

Browse files
eugene-karunaEugene Karuna
andauthored
Add location_country field to events.yaml and update addressCountry in show.antlers.html (#35)
- 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. Co-authored-by: Eugene Karuna <[email protected]>
1 parent aa1078a commit ef6ca40

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

resources/presets/events/resources/blueprints/collections/events/events.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,28 @@ tabs:
179179
- sometimes
180180
if:
181181
{{ singular_handle }}_type: 'equals offline'
182+
-
183+
handle: location_country
184+
field:
185+
input_type: text
186+
antlers: false
187+
display: Country
188+
type: text
189+
icon: text
190+
listable: hidden
191+
instructions_position: above
192+
visibility: visible
193+
always_save: false
194+
width: 50
195+
instructions: 'Enter the two-letter ISO country code (e.g., NL, US, GB). If left empty, the site locale will be used.'
196+
placeholder: 'e.g., NL'
197+
validate:
198+
- sometimes
199+
- max:2
200+
- min:2
201+
- alpha
202+
if:
203+
{{ singular_handle }}_type: 'equals offline'
182204
-
183205
handle: {{ singular_handle }}_url
184206
field:

resources/presets/events/resources/views/events/show.antlers.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@type": "PostalAddress",
2222
"streetAddress": "{{ location_address }}",
2323
"addressLocality": "{{ location_locality }}",
24-
"addressCountry": "NL"
24+
"addressCountry": "{{ location_country | upper ?? site:short_locale | upper }}"
2525
}
2626
},
2727
{{ elseif {{ singular_handle }}_type.value == 'online' }}

0 commit comments

Comments
 (0)