Skip to main content
improved formatting
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

@user61857 It'sThe other answer pointed me in the right direction, thanks for your help. The
The merge filter didn't work for me, not sure. I don't know what I was goingdoing wrong, so I used thea simpler optionsolution.

      {% elseif option.type == 'option' %}
        {# custom if statement #}
        {% if option.label == '- Any -' %}
          <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>- All -</option>
        {% else %}
          <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
        {%  endif %}
      {% endif %}

happy drupaling

{% elseif option.type == 'option' %}
  {# custom if statement #}
  {% if option.label == '- Any -' %}
    <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>- All -</option>
  {% else %}
    <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
  {%  endif %}
{% endif %}

@user61857 It's pointed me in the right direction, thanks for your help. The merge filter didn't work for me, not sure what was going wrong so I used the simpler option.

      {% elseif option.type == 'option' %}
        {# custom if statement #}
        {% if option.label == '- Any -' %}
          <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>- All -</option>
        {% else %}
          <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
        {%  endif %}
      {% endif %}

happy drupaling

The other answer pointed me in the right direction.
The merge filter didn't work for me. I don't know what I was doing wrong, so I used a simpler solution.

{% elseif option.type == 'option' %}
  {# custom if statement #}
  {% if option.label == '- Any -' %}
    <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>- All -</option>
  {% else %}
    <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
  {%  endif %}
{% endif %}
Source Link

@user61857 It's pointed me in the right direction, thanks for your help. The merge filter didn't work for me, not sure what was going wrong so I used the simpler option.

      {% elseif option.type == 'option' %}
        {# custom if statement #}
        {% if option.label == '- Any -' %}
          <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>- All -</option>
        {% else %}
          <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
        {%  endif %}
      {% endif %}

happy drupaling