hook_theme_suggestions_HOOK_alter() Call to undefined method id()

Created on 4 April 2024, about 1 year ago
Updated 30 April 2024, 12 months ago

The $variables array element "content" doesn't contain anymore the old data structure (see screenshot in attachment).

This means that the following script doesn't work anymore:

/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function MY_MODULE_theme_suggestions_printable_alter(array &$suggestions, array $variables) {
$suggestions[] = 'printable__' . $variables['content']['#node']->type->entity->id();
}

and templates are not overridden anymore.

🐛 Bug report
Status

Fixed

Version

3.1

Component

Code

Created by

🇧🇪Belgium fab01

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024