You are here

function views_preprocess_comment in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/views.module \views_preprocess_comment()
  2. 9 core/modules/views/views.module \views_preprocess_comment()

A theme preprocess function to automatically allow view-based node templates if called from a view.

File

core/modules/views/views.module, line 260
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_preprocess_comment(&$variables) {

  // The view data is added to the comment in
  // \Drupal\views\Plugin\views\row\EntityRow::preRender().
  if (!empty($variables['comment']->view) && $variables['comment']->view->storage
    ->id()) {
    $variables['view'] = $variables['comment']->view;
  }
}