Submitted by melinda on Mon, 01/22/2024 - 23:48
I don't know why this isn't any where on the web... Or at least that I could find.
I needed my block to show an image at full width if the editor selected it and another display if the editor did not select it.
For this to work you need to make sure your boolean field is set to "1/0" in two places. The content type Fields Display section and in your view in the field.
{% if fields.field_image_fullwidth.content |striptags|trim == '1' %}
<div id="sponsor-box-container">
<div class="full-sponsor-box-image">
{{ fields.field_ad_preview_image.content }}
</div>
</div>
{% else %}
<div id="sponsor-box-container">
<div class="sponsor-box-image">
{{ fields.field_ad_preview_image.content }}
</div>
<div class="sponsor-box-ad-text">
<p class="sponsored-text">SPONSORED</p>
<h3>{{ fields.field_ad_title.content }}</h3>
{{ fields.field_teaser_text.content }}
</div>
</div>
{% endif %}