Remove dependency on hardcoded classes in views template

Created on 28 May 2024, about 1 month ago
Updated 4 June 2024, 24 days 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 1 minute 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.69.0 2024