views-view-fields--machine_name--.html.twig
{{ fields.machine_name.content }}
<div class="row {{ cycle(['left','right'],row.index)}}">
{% set foo = cycle(['left','right'],row.index) %}
{% if foo == "left" %}
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 left-img">
<div class="img-box">
{{ fields.field_image.content }}
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 right-content">
<div class="content">
<h2>{{ fields.title.content }}</h2>
{{ fields.body.content }}
{{ fields.field_button.content }}
</div>
</div>
{% else %}
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 left-content">
<div class="content">
<h2>{{ fields.title.content }}</h2>
{{ fields.body.content }}
{{ fields.field_button.content }}
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 right-img">
<div class="img-box">
{{ fields.field_image.content }}
</div>
</div>
{% endif %}
</div>
{% for key, option in content.field_block_items %}
{% set direction = loop.index0 is odd ? 'resp-show' : 'resp-hide' %}
{% if option['#paragraph'].field_description_new.value is not empty %}
<div class="row mb-3">
{% if direction == 'resp-show' %}
<div class="col-md-1">
<img src="{{ file_url(option['#paragraph'].field_link_logo.entity.uri.value) }}" width="100" class="img-responsive" alt="">
</div>
{% endif %}
<div class="col-md-10">
<div class=" text-white text-right ">{{ option['#paragraph'].field_description_new.value|raw }}</div>
</div>
{% if direction == 'resp-hide' %}
<div class="col-md-1">
<img src="{{ file_url(option['#paragraph'].field_link_logo.entity.uri.value) }}" width="100" class="{{ direction }} img-responsive" alt="">
</div>
{% endif %}
</div>
{% endif %}
{% endfor %}
No comments:
Post a Comment
If you have any problem please let me know.