Skip to content

Instantly share code, notes, and snippets.

@ankedsgn
Created September 8, 2017 14:36
Show Gist options
  • Save ankedsgn/a32df0d13c4f53f1b2d01bf21087a9d2 to your computer and use it in GitHub Desktop.
Save ankedsgn/a32df0d13c4f53f1b2d01bf21087a9d2 to your computer and use it in GitHub Desktop.
In contenttype.yml
imagelicense:
label: "Image License"
type: select
values:
'Public-Domain' : 'Public Domain'
'CC0' : 'CC0'
'CC-BY' : 'CC BY'
'CC-BY-SA' : 'CC BY-SA'
'CC-BY-NC' : 'CC BY-NC'
'CC-BY-NC-SA' : 'CC BY-NC-SA'
In twig:
{% if (record.imagelicense is defined and record.imagelicense is not empty) %}
{% set labels = record.contenttype.fields.imagelicense.values %}
<span class="image-license">{{ labels[record.imagelicense] }}</span>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment