function ViewsHooks::themeSuggestionsCommentAlter

Implements hook_theme_suggestions_HOOK_alter().

Attributes

#[Hook('theme_suggestions_comment_alter')]

File

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

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();
    $suggestions['__DEPRECATED']['comment__view__' . $comment->view->storage
      ->id()] = 'Theme suggestion comment__view__' . $comment->view->storage
      ->id() . ' is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. See https://www.drupal.org/node/3541462';
    if (!empty($comment->view->current_display)) {
      $suggestions[] = 'comment__view__' . $comment->view->storage
        ->id() . '__' . $comment->view->current_display;
      $suggestions['__DEPRECATED']['comment__view__' . $comment->view->storage
        ->id() . '__' . $comment->view->current_display] = 'Theme suggestion comment__view__' . $comment->view->storage
        ->id() . '__' . $comment->view->current_display . ' is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. See https://www.drupal.org/node/3541462';
    }
  }
}

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