Problem/Motivation

It would be beneficial to have view suggestions supported out of the box.

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function THEME_HOOK_theme_suggestions_views_view_alter(
  array &$suggestions,
  array $variables
): void {
  $view = $variables['view'];

  if (
    $view instanceof ViewExecutable
    && $display = $view->current_display
  ) {
    $view_id = $view->id();
    $original = $variables['theme_hook_original'];

    $suggestions[] = "{$original}__$view_id";
    $suggestions[] = "{$original}__{$view_id}__$display";
  }
}

Issue fork prototype-3483019

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

droath created an issue. See original summary.

jldust’s picture

Version: 5.2.1-alpha3 » 5.x-dev
Assigned: Unassigned » jldust

  • jldust committed 257f8737 on 5.x
    Issue #3483019 by jldust, droath: Add views theme suggestions 
    
jldust’s picture

Status: Active » Reviewed & tested by the community
jldust’s picture

Status: Reviewed & tested by the community » Fixed

This has been merged in and will be included in the next tagged release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.