Skip to content

Latest commit

History

History
51 lines (41 loc) 路 1.26 KB

enum_values_in_templates.md

File metadata and controls

51 lines (41 loc) 路 1.26 KB

ENUM values in templates

There are two TWIG functions which can help you to get array of ENUM values in your templates. They are enum_values() and enum_readable_values().

Example of using enum_values()

{% for value in enum_values('BasketballPositionType') %}
    {{ value }}<br />
{% endfor %}
Result HTML
PG
SG
SF
PF
C

Example of using enum_readable_values()

{% for key, value in enum_readable_values('BasketballPositionType') %}
    {{ key }} => {{ value }}<br />
{% endfor %}
Result HTML
PG => Point Guard
SG => Shooting Guard
SF => Small Forward
PF => Power Forward
C => Center

More features