I know there are some tutorials online about how to do this, but for some reason I doesn't work.
I would like to add a file theme suggestion on the "Theme Hook: Page" level of the template with the name of the content type (this way I can let all items of this content type use this template).
So, I add this to my MYTHEME.theme.php
file:
function MYTHEME_theme_suggestions_page_alter(array &$suggestions, array $variables) {
if ($node = \Drupal::request()->attributes->get('node')) {
array_splice($suggestions, 1, 0, 'page__node__' . $node->getType());
}
}
So you would expect the following output:
- page--node--19.html.twig
- page--node--%.html.twig
- page--node--dish.html.twig // Gets not added
- page--node.html.twig
- page.html.twig
I already tried clearing the cache. I'm using Drupal 8.1
What am I missing here?