Skip to content

Instantly share code, notes, and snippets.

@brandonkelly
Created May 24, 2013 12:27
Show Gist options
  • Save brandonkelly/5643159 to your computer and use it in GitHub Desktop.
Save brandonkelly/5643159 to your computer and use it in GitHub Desktop.
Upcoming BaseOptionsFieldType templating options
{% if entry.drinkAttributes.contains('alcoholic') %}
Alcoholic!
{% else %}
Not alcoholic
{% endif %}
<h2>Selected Attributes</h2>
<table>
{% for attr in entry.drinkAttributes %}
<tr>
<td>{{ attr }}</td>
<td>{{ attr.value }}</td>
<td>{{ attr.label }}</td>
</tr>
{% endfor %}
</table>
<h2>All Attributes</h2>
<table>
{% for attr in entry.drinkAttributes.options %}
<tr>
<td>[ {{ attr.selected ? '√' : '&nbsp;&nbsp;' }} ]</td>
<td>{{ attr }}</td>
<td>{{ attr.value }}</td>
<td>{{ attr.label }}</td>
</tr>
{% endfor %}
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment