diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php index 6850fcb..d6624cc 100644 --- a/core/lib/Drupal/Core/Theme/ThemeManager.php +++ b/core/lib/Drupal/Core/Theme/ThemeManager.php @@ -286,6 +286,20 @@ protected function theme($hook, $variables = array()) { include_once $this->root . '/' . $include_file; } } + + // If base hook has variables defined we want to merge them so they don't + // have to be set manually when base hook is defined. + if (!empty($base_hook_info['variables'])) { + $variables['variables'] = array_merge($base_hook_info['variables'], $variables['variables']); + } + + // If render element haven't been defined for current element try to get + // it from the base hook. + if (empty($info['render element']) && !empty($base_hook_info['render element'])) { + $info['render element'] = $base_hook_info['render element']; + $variables += array($info['render element'] => array()); + } + // Replace the preprocess functions with those from the base hook. if (isset($base_hook_info['preprocess functions'])) { // Set a variable for the 'theme_hook_suggestion'. This is used to