Mercurial > hg > isophonics-drupal-site
diff core/lib/Drupal/Core/Theme/Registry.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
line wrap: on
line diff
--- a/core/lib/Drupal/Core/Theme/Registry.php Mon Apr 23 09:33:26 2018 +0100 +++ b/core/lib/Drupal/Core/Theme/Registry.php Mon Apr 23 09:46:53 2018 +0100 @@ -2,6 +2,7 @@ namespace Drupal\Core\Theme; +use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\DestructableInterface; @@ -565,10 +566,18 @@ $info['preprocess functions'] = array_merge($cache[$hook]['preprocess functions'], $info['preprocess functions']); } $result[$hook]['preprocess functions'] = $info['preprocess functions']; + + // 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']); + } } // Merge the newly created theme hooks into the existing cache. - $cache = $result + $cache; + $cache = NestedArray::mergeDeep($cache, $result); } // Let themes have variable preprocessors even if they didn't register a