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;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.