diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 6b6fd86..7cf4b3c 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -567,13 +567,11 @@ protected function processExtension(array &$cache, $name, $type, $theme, $path) } $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'])) { + // If a theme implementation definition provides both 'template' and + // 'function', the 'function' will be used. In this case, if the new + // result provides a 'template' value, any existing 'function' value + // must be removed for the override to be called. + if (isset($result[$hook]['template'])) { unset($cache[$hook]['function']); } }