function views_preprocess_comment

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

File

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

Code

function views_preprocess_comment(&$vars) {

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