diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 7c9f4d1..6b6fd86 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -566,6 +566,16 @@ protected function processExtension(array &$cache, $name, $type, $theme, $path) $info['preprocess functions'] = array_merge($cache[$hook]['preprocess functions'], $info['preprocess functions']); } $result[$hook]['preprocess functions'] = $info['preprocess functions']; + + // Before merging the new result with the original information, ensure + // that the final result does not end up with both a template and a + // function defined. + if (isset($result[$hook]['function'])) { + unset($cache[$hook]['template']); + } + elseif (isset($result[$hook]['template'])) { + unset($cache[$hook]['function']); + } } // Merge the newly created theme hooks into the existing cache.