Views display title not visible

Changed

Views attachments don't print their title.

Attempting to use text in header area as a workaround works for attachments, but the main display header printed 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 %}
Task type
Project
Topics
Modules