Print select option value in modular page

Hi everyone,

I’ve added a select field in one modular yml with some options. With the value_only: true option I managed to display the value instead of the key in admin panel. Now how can I display the same value in the frontend? Doing element.field return the key instead of the value.

Here the specific blueprint

              type: select
              label: Footer
              label: Choose the feature
              value_only: true
                ciao: ciao
                come: Come
                stai: stai?

Here the TWIG template part

{% if feature.footer %}
  <h2>{{ }}</h2>
{% endif %}

Ty for the support.

hi @matteoredz

Interresting question :wink:

i think value_only is only for the array field.

i test in my page blueprint i use Antimatter blog.yaml

                type: select
                label: 'Choose the feature'
                    ciao: ciao bella
                    come: Come va
                    stai: Come stai?

so in in front matter the value saved is test: stai for instance

Then i retrieve the select field in order to have an array then i check if my page.header.test equal key if so i print the value associated to that key

{% set select =['header.test'].options %}

{% for  key,value  in select %}
  {% if page.header.test == key %}
  {% endif %}
{% endfor %}

So to retrieve the correct select option array with
{% set select =['header.test'].options %}
you have to adapt your ‘path’ in my example['header.test']

Maybe there is another solution

Hope that helps !