diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index cb9fe42..317bada 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -456,12 +456,14 @@ protected function processExtension(array &$cache, $name, $type, $theme, $path) // A template file is the default implementation for a theme hook, but // if the theme hook specifies a function callback instead, check to // ensure the function actually exists. - if (isset($info['function']) && !function_exists($info['function'])) { - throw new \BadFunctionCallException(sprintf( - 'Theme hook "%s" refers to a theme function callback that does not exist: "%s"', - $hook, - $info['function'] - )); + if (isset($info['function'])) { + if (!function_exists($info['function'])) { + throw new \BadFunctionCallException(sprintf( + 'Theme hook "%s" refers to a theme function callback that does not exist: "%s"', + $hook, + $info['function'] + )); + } } // Provide a default naming convention for 'template' based on the // hook used. If the template does not exist, the theme engine used @@ -490,11 +492,8 @@ protected function processExtension(array &$cache, $name, $type, $theme, $path) $info['preprocess functions'] = array(); $prefixes = array(); if ($type == 'module') { - // Add template preprocessor only for templates. - if (!isset($info['function'])) { - // Default variable preprocessor prefix. - $prefixes[] = 'template'; - } + // Default variable preprocessor prefix. + $prefixes[] = 'template'; // Add all modules so they can intervene with their own variable // preprocessors. This allows them to provide variable preprocessors // even if they are not the owner of the current hook.