1 views.module views_preprocess_comment(&$variables)

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

File

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

Code

function views_preprocess_comment(&$variables) {
  // The 'view' attribute of the node is added in template_preprocess_views_view_row_comment()
  if (!empty($variables['node']->view) && !empty($variables['node']->view->name)) {
    $variables['view'] = &$variables['node']->view;
    $variables['theme_hook_suggestions'][] = 'comment__view__' . $variables['node']->view->name;
    if (!empty($variables['node']->view->current_display)) {
      $variables['theme_hook_suggestions'][] = 'comment__view__' . $variables['node']->view->name . '__' . $variables['node']->view->current_display;
    }
  }
}