Context
Create a view that shows overdue chores, filtered by next due date < today.
Issues
Views attachments don't print their title.
Attempt to use text in header area works for attachments, but the main display header is above the attachments.
I could make the main display be the one at the top, and place attachments after it.
The previous view used a hack - add the display title as a field, then group by it.
This could be fixed by modifying templates, or a preprocess hook. What should the rule be?
https://www.drupal.org/project/views/issues/1619498#comment-6336510
The display type and title can be added as variables to use in the template.
function mantra_starter_preprocess_views_view(&$variables) {
/* @var $view \Drupal\views\ViewExecutable */
$view = $variables['view'];
$variables['display_type'] = $view->getDisplay()->getPluginId();
$variables['display_title'] = $view->display_handler->display['display_title'];
}{{ title_prefix }}
{% if title %}
{{ title }}
{% endif %}
{% if display_type == 'attachment' %}
<h2>{{ display_title }}</h2>
{% endif %}
{{ title_suffix }}{% if attachment_before %}
<div class="attachment attachment-before">
{{ attachment_before }}
</div>
<h2>{{ display_title }}</h2>
{% endif %}Done
New chores dasboard view to replace existing one: https://inventory.mantra.network/chores-dashboard