Skip to content

Commit

Permalink
feat(blocks): add new attr macros selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed May 22, 2021
1 parent 1548873 commit 1c3fc79
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions blocks/macros/attr.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@
{% endapply %}
{% endmacro %}

{% macro selected(key, block, values, value) %}
{% apply spaceless %}
{% if (arrays(values).has(block)) %}
{% set value = arrays(values).get(block)|raw %}
{% else %}
{% set value = value|raw %}
{% endif %}

{% if key == value %}
selected="selected"
{% endif %}
{% endapply %}
{% endmacro %}

{% macro validation(validation) %}
{% apply spaceless %}
{% if validation %}
Expand Down

0 comments on commit 1c3fc79

Please sign in to comment.