diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 3bc45a7..08fc1bc 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -138,16 +138,18 @@ class Registry implements DestructableInterface { protected $themeManager; /** - * User functions grouped by the word before the first underscore. + * User function names grouped by the word before the first underscore. * - * @var array + * @var string[] */ protected $groupedFunctions = []; /** * All user-defined functions that have been added to groupedFunctions. * - * @var array + * The array keys are the function names, for faster dereferencing. + * + * @var bool[] */ protected $seenFunctions = []; @@ -455,8 +457,8 @@ protected function processExtension(array &$cache, $name, $type, $theme, $path) $result[$hook]['type'] = $type; $result[$hook]['theme path'] = $path; - // If theme hook has base hook mark its preprocess functions always - // incomplete to inherit base hooks preprocess functions. + // If a theme hook has a base hook, mark its preprocess functions always + // incomplete in order to inherit the base hook's preprocess functions. if (!empty($result[$hook]['base hook'])) { $result[$hook]['incomplete preprocess functions'] = TRUE; } @@ -635,7 +637,7 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) { // Gather prefixes. This will be used to limit the found functions to the // expected naming conventions. - $prefixes = array_keys((array) $this->moduleHandler->getModuleList()); + $prefixes = array_keys($this->moduleHandler->getModuleList()); foreach (array_reverse($theme->getBaseThemes()) as $base) { $prefixes[] = $base->getName(); } @@ -668,8 +670,8 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) { } } - // Add missing variable preprocessors. This is needed for hooks that do not - // explicitly register the hook. For example, when a theme contains a + // Add missing variable preprocessors. This is needed for modules that do + // not explicitly register the hook. For example, when a theme contains a // variable preprocess function but it does not implement a template, it // 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 @@ -689,8 +691,8 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) { } } } - // Inherit all base hook variable preprocess functions into suggestion hooks. - // This ensures that derivative hooks have a complete set of variable + // Inherit all base hook variable preprocess functions into suggestion + // hooks. This ensures that derivative hooks have a complete set of variable // preprocess functions. foreach ($cache as $hook => $info) { // The 'base hook' is only applied to derivative hooks already registered