Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ViewsHooks.php

function ViewsHooks::themeSuggestionsCommentAlter

Implements hook_theme_suggestions_HOOK_alter().

File

core/modules/views/src/Hook/ViewsHooks.php, line 240

Class

ViewsHooks
Hook implementations for views.

Namespace

Drupal\views\Hook

Code

public function themeSuggestionsCommentAlter(array &$suggestions, array $variables) : void {
    $comment = $variables['elements']['#comment'];
    if (!empty($comment->view) && $comment->view->storage
        ->id()) {
        $suggestions[] = 'comment__view__' . $comment->view->storage
            ->id();
        if (!empty($comment->view->current_display)) {
            $suggestions[] = 'comment__view__' . $comment->view->storage
                ->id() . '__' . $comment->view->current_display;
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal