Problem/Motivation
Deprecated theme suggestions can be added through the `__DEPRECATED`-key when adding suggestions.
This causes a fatal error in conjunction with the Preprocess-module, in the `PreprocessManager::preprocess` function we loop over the $suggestions and check if each theme_registry has the given suggestion, but the `__DEPRECATED` key is also available in the `$suggestions`-array, and the `__DEPRECATED` key is an array that contains one or more deprecated theme suggestions.
The cause of this issue, for us, was: https://www.drupal.org/node/3541462
Steps to reproduce
- Install preprocess on a Drupal 11.3 site
- See the error appear whenever a node inside a view gets preprocessed
Proposed resolution
Unset the `__DEPRECATED` key like the ThemeManager does during rendering (\Drupal\Core\Theme\ThemeManager::render() on line 224 in Drupal 11.3.10) like so:
if (isset($suggestions['__DEPRECATED'])) {
unset($suggestions['__DEPRECATED']);
}Issue fork preprocess-3592527
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
randalv commentedComment #4
randalv commentedComment #6
sjerdoComment #8
sjerdoThanks! Merged and tagged new version 2.2.3
Comment #9
sjerdo