diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 65d2afe..5ed0af6 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -637,14 +637,6 @@ protected function mergePreprocessFunctions($hook, $complete_hook, array &$cache $preprocess_functions = $cache[$complete_hook]['preprocess functions']; } - // If the hook we are completing exists, preserve it's data. - if (isset($cache[$hook])) { - $cache[$hook] = array_merge($cache[$complete_hook], $cache[$hook]); - } - else { - $cache[$hook] = $cache[$complete_hook]; - } - $cache[$hook]['preprocess functions'] = $preprocess_functions; unset($cache[$hook]['incomplete preprocess functions']); } @@ -728,7 +720,9 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) { // from a pattern. This is typically set from // drupal_find_theme_functions() and drupal_find_theme_templates(). if (isset($info['incomplete preprocess functions'])) { - // Handle manually set base hooks and suggestion hooks differently. + // Suggestion hooks inherit from their preceding suggestion hooks first + // whereas hooks with a manually set "base hook" key can just be + // completed based on the hook given. if (strpos($hook, '__')) { $this->completeSuggestion($hook, $cache); } diff --git a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php index f3eb364..9caa72e 100644 --- a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php @@ -5,25 +5,6 @@ * Contains \Drupal\Tests\Core\Theme\RegistryTest. */ -namespace Drupal\Core\Theme { - - /** - * Override get_defined_functions with a configurable mock. - * - * Registry::getPrefixGroupedUserFunctions calls get_defined_functions and - * that is overridden here to allow testing postProcessExtension. - */ - function get_defined_functions() { - if (\Drupal\Tests\Core\Theme\RegistryTest::$functions) { - return \Drupal\Tests\Core\Theme\RegistryTest::$functions; - } - else { - return \get_defined_functions(); - } - } - -} - namespace Drupal\Tests\Core\Theme { use Drupal\Core\Theme\ActiveTheme; @@ -312,3 +293,22 @@ protected function initializeTheme() { } } + +namespace Drupal\Core\Theme { + + /** + * Override get_defined_functions with a configurable mock. + * + * Registry::getPrefixGroupedUserFunctions calls get_defined_functions and + * that is overridden here to allow testing postProcessExtension. + */ + function get_defined_functions() { + if (\Drupal\Tests\Core\Theme\RegistryTest::$functions) { + return \Drupal\Tests\Core\Theme\RegistryTest::$functions; + } + else { + return \get_defined_functions(); + } + } + +}