In the template file for a view with grouped rows, I would like to add the group title as class name, but the rendered class name from the title variable is just _ on every group. This is the generated HTML markup for the group whose title is 1.
<h3 class="views-group group-_">1</h3>
What's wrong here?
This is the template file content.
{#
/**
* @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 %}
{%
set classes = [
'views-group',
'group-' ~ title|clean_class,
]
%}
<h3{{ content_attributes.addClass(classes) }}>{{ title }}</h3>
{% endif %}
{% for row in rows %}
{%
set row_classes = [
default_row_class ? 'views-row',
]
%}
<div{{ row.attributes.addClass(row_classes) }}>
{{- row.content -}}
</div>
{% endfor %}