Commit 5a798836 authored by alexpott's avatar alexpott

Issue #2556785 by Antti J. Salminen, lauriii: Specific preprocess functions...

Issue #2556785 by Antti J. Salminen, lauriii: Specific preprocess functions doesn't support second level without first level
parent 112e9bf2
......@@ -669,8 +669,9 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) {
// will go missing. This will add the expected function. It also allows
// modules or themes to have a variable process function based on a pattern
// even if the hook does not exist.
for ($level = 1; $level <= count($suggestion_level); $level++) {
foreach ($suggestion_level[$level] as $preprocessor => $hook) {
ksort($suggestion_level);
foreach ($suggestion_level as $level => $item) {
foreach ($item as $preprocessor => $hook) {
if (isset($cache[$hook]['preprocess functions']) && !in_array($hook, $cache[$hook]['preprocess functions'])) {
// Add missing preprocessor to existing hook.
$cache[$hook]['preprocess functions'][] = $preprocessor;
......
......@@ -269,15 +269,6 @@ function rdf_preprocess_html(&$variables) {
}
}
/**
* Implements hook_preprocess_HOOK().
*
* @todo remove after https://www.drupal.org/node/2556785 is fixed.
*/
function rdf_preprocess_field__node(&$variables) {
// Just an empty hook to avoid https://www.drupal.org/node/2556785.
}
/**
* Implements hook_preprocess_HOOK() for UID field templates.
*/
......
......@@ -139,6 +139,7 @@ public function testSuggestionPreprocessFunctions() {
$preprocess_functions = $registry_theme->get()['theme_test_preprocess_suggestions__kitten__bearcat']['preprocess functions'];
$this->assertIdentical($expected_preprocess_functions, $preprocess_functions, 'Suggestion implemented as a template correctly inherits preprocess functions.');
$this->assertTrue(isset($registry_theme->get()['theme_test_preprocess_suggestions__kitten__meerkat__tarsier__moose']), 'Preprocess function with an unimplemented lower-level suggestion is added to the registry.');
}
/**
......
......@@ -142,3 +142,10 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten(&$varia
function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__flamingo(&$variables) {
$variables['bar'] = 'Flamingo';
}
/**
* Tests a preprocess function with suggestions.
*/
function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__meerkat__tarsier__moose(&$variables) {
$variables['bar'] = 'Moose';
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment