0
votes

We have content types with panel and panelizer enabled. We have added theme suggestions for content view page as follows.

function HOOK_theme_suggestions_page_alter(array &$suggestions, array $variables) {
    $node = \Drupal::routeMatch()->getParameter('node');
    if(!empty($node)){
        $type = $node->getType();
        if($type == 'abc'){
            $suggestions[] = 'page__abc';            
        }
   }
}

The defined template file is coming for node view page. But when we check for node preview this "page--abc.html.twig" is not coming. Node preview page rendering by page.html.twig.

Please guide me how to make this "page--abc.html.twig" for node preview. Thanks in advance.

1

1 Answers

0
votes

you can read hook template_preprocess_node

  if ($variables['view_mode']) {
    $variables['theme_hook_suggestions'][] = 'node__' . $variables['view_mode'];
  }