You are here

function node_preprocess_html in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/node/node.module \node_preprocess_html()
  2. 9 core/modules/node/node.module \node_preprocess_html()

Implements hook_preprocess_HOOK() for HTML document templates.


core/modules/node/node.module, line 409
The core module that allows content to be submitted to the site.


function node_preprocess_html(&$variables) {

  // If on an individual node page or node preview page, add the node type to
  // the body classes.
  if (($node = \Drupal::routeMatch()
    ->getParameter('node')) || ($node = \Drupal::routeMatch()
    ->getParameter('node_preview'))) {
    if ($node instanceof NodeInterface) {
      $variables['node_type'] = $node