Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deviantintegral/9cc04b6a95082673b540 to your computer and use it in GitHub Desktop.
Save deviantintegral/9cc04b6a95082673b540 to your computer and use it in GitHub Desktop.
{#
/**
* @file
* Default theme implementation to display a view of unformatted rows.
*
* Available variables:
* - title: The title of this group of rows. May be empty.
* - rows: A list of the view's row items.
* - attributes: The row's HTML attributes.
* - content: The row's content.
* - view: The view object.
* - default_row_class: A flag indicating whether default classes should be
* used on rows.
*
* @see template_preprocess_views_view_unformatted()
*
* @ingroup themeable
*/
#}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
{% set even_rows = "" %}
{% set odd_rows = "" %}
{% for row in rows %}
{%
set row_classes = [
default_row_class ? 'views-row',
]
%}
{% set row %}
<div{{ row.attributes.addClass(row_classes) }}>
{{ row.content }}
</div>
{% endset %}
{% if loop.index is divisible by (2) %}
{% set even_rows = even_rows ~ row %}
{% else %}
{% set odd_rows = odd_rows ~ row %}
{% endif %}
{% endfor %}
<div class="this-is-the-main-div">
<div class="odd-rows">
{{ odd_rows|raw }}
</div>
<div class="even-rows">
{{ even_rows|raw }}
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment