You are here

function uc_product_preprocess_html in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_product/uc_product.module \uc_product_preprocess_html()

Implements hook_preprocess_html().

Adds a body class to product node pages.

See also

html.html.twig

File

uc_product/uc_product.module, line 329
The product module for Ubercart.

Code

function uc_product_preprocess_html(&$variables) {
  $request = \Drupal::request();
  if ($request->attributes
    ->has('node')) {
    if (uc_product_is_product($request->attributes
      ->get('node'))) {
      $variables['attributes']['class'][] = 'uc-product-node';
    }
  }
}