Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. views.module

function views_preprocess_comment

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

File

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

Code

function views_preprocess_comment(&$variables) : void {
    // 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;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal