Twig condition for select field doubles value in Views

Support MB Views Twig condition for select field doubles value in Views

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33717
    synchrosynchro
    Participant

    Hi, I followed this topic to display my select field values:

    https://support.metabox.io/topic/twiq-if-condition-with-checkbox-list/

    And it works generally, but the displayed value is doubled. You can see it here:

    https://mega.nz/file/mt5WADDS#2fpZ_FGXn851-kvHx-WdbmU0sfW-2fktODsbf7Yr1TA

    The code I used in the view:

    {% set value = 'anulowany' %}
    {% for item in user.status_wniosku %}
        {% if value in item %}
            <div class="status-anulowany">Anulowany</div>
        {% endif %}
    {% endfor %}

    Again, I appreciate your help with this thing.

    #33766
    Long NguyenLong Nguyen
    Moderator

    Hi,

    That means the user field status_wniosku has two values and both have anulowany. You can try to print the item to check its value.

    {% set value = 'anulowany' %}
    {% for item in user.status_wniosku %}
        {{ item }}
        {% if value in item %}
        <div class="status-anulowany">Anulowany</div>
        {% endif %}
    {% endfor %}
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.