How to iterate and print the text of a select’s option (instead of value) from composite using Twig?
I would like to iterate and print the text of the option (book) that is selected by the user. I know that what I have
{% for item in data.item %} <tr> <td style="text-align: center;">{{ item.qty }} </td> <td style="text-align: center;">{{ item.book }}</td> </tr> {% endfor %}
will only print the value (key) of the option, but I would like to print the text. What change do I need to make?
Thank you
This article was republished from its original source.
Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.