https://git.drupalcode.org/project/bootstrap_storybook/-/blob/3.1.x/src/...

it will miss the node-type class when in preview mode.

can do this:

  if (($node = \Drupal::routeMatch()->getParameter('node')) || ($node = \Drupal::routeMatch()->getParameter('node_preview'))) {
    if ($node instanceof NodeInterface) {
      // Add node ID body class.
      $variables['attributes']['class'][] = 'node-' . $node->id();

      // Add content type machine name body class.
      $variables['attributes']['class'][] = 'node-type--' . str_replace('_', '-', $node->bundle());
    }
  }

This is only fix for this class in body tag, not sure somewhere still need do the same thing. I used this toppest class and be able to find this issue.

Not sure how fork works in drupal gitlab, looks like not really convenice.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

yi_jiang created an issue. See original summary.

doxigo’s picture

Version: 3.1.7 » 3.1.x-dev

  • doxigo committed fda154b on 3.1.x authored by yi_jiang
    Issue #3193420 by yi_jiang: body node type class missing when preview
    
doxigo’s picture

Status: Active » Fixed

Also another good catch, thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.