Answer the question
In order to leave comments, you need to log in
How to override page template for specific content type in Drupal 8?
In Drupal 7 this was done in template.tpl.php:
function yourthemename_preprocess_page(&$vars) {
if (isset($vars['node']->type)) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type; }
}
page--<node_type>.tpl.php
Answer the question
In order to leave comments, you need to log in
I am answering my previous questions.
In the theme_get_suggestions hook we write the following:
if ($node = \Drupal::routeMatch()->getParameter('node')) {
$suggestions[] = $prefix . $delimiter . $node->getType();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question