function node_theme_suggestions_node in Drupal 9
Same name and namespace in other branches
- 8 core/modules/node/node.module \node_theme_suggestions_node()
Implements hook_theme_suggestions_HOOK().
File
- core/
modules/ node/ node.module, line 459 - The core module that allows content to be submitted to the site.
Code
function node_theme_suggestions_node(array $variables) {
$suggestions = [];
$node = $variables['elements']['#node'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'node__' . $sanitized_view_mode;
$suggestions[] = 'node__' . $node
->bundle();
$suggestions[] = 'node__' . $node
->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'node__' . $node
->id();
$suggestions[] = 'node__' . $node
->id() . '__' . $sanitized_view_mode;
return $suggestions;
}