Remove dependency on hardcoded classes in views template

Created on 28 May 2024, 6 months ago
Updated 17 July 2024, 4 months ago

In core drupal the view.views.html.twig contains the following:

  {% if rows -%}
    {{ rows }}
  {% elseif empty -%}
    {{ empty }}
  {% endif %}
  {{ pager }}

And in Olivero and other theme implementations we typically have

  {% if rows %}
    <div class="view-content">
      {{ rows }}
    </div>
  {% elseif empty %}
    <div class="view-empty">
      {{ empty }}
    </div>
  {% endif %}

Here we can see that the classes view-content and view-empty are hardcoded in the twig template.

This assumes that all views and view styles use the same markup, but we can see modules like view infinite scroll also inject a container, so I think it would be useful if this hardcoded dependency was removed. e.g. we could also add a row or other row container class(es).

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Views 

Last updated about 4 hours ago

Created by

🇬🇧United Kingdom 2dareis2do

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024