function views_preprocess_comment

Same name in other branches
  1. 9 core/modules/views/views.module \views_preprocess_comment()
  2. 8.9.x core/modules/views/views.module \views_preprocess_comment()
  3. 11.x core/modules/views/views.module \views_preprocess_comment()

Allows view-based comment templates if called from a view.

File

core/modules/views/views.module, line 267

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

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