简体   繁体   中英

How to get value of option from select

I contributed in back-office a select attribute with two options but when I'm doing

{{ ez_field_value(content, 'value') }} 

I get 0 or 1 according to I contributed on back-office.
How to get value of this select attribute ?

I don't think there's a readily available way to get the clean value of the option from Twig.

What you can do though is use {{ ez_render_field(content, 'my_field') }} which will render the option name in a div element, but with added ezselection-field CSS class attached to it, like so:

<div class="ezselection-field">My option</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM