protected function build() { $cache =
[];
// First, preprocess the theme hooks advertised by modules. This will
// serve as the basic registry. Since the list of enabled modules is the
// same regardless of the theme used, this is cached in its own entry to
// save building it for every theme.
if ($cached =
$this->cache->
get('theme_registry:build:modules'
)) { $cache =
$cached->data;
} else { $this->moduleHandler->
invokeAllWith('theme',
function Dcallable
$callback, string
$module) use (&
$cache) { $this->
processExtension($cache,
$module, 'module',
$module,
$this->moduleList->
getPath($module));
});
// Only cache this registry if all modules are loaded.
if ($this->moduleHandler->
isLoaded()) { $this->cache->
set("theme_registry:build:modules",
$cache, Cache::PERMANENT,
['theme_registry'
]);
} } // Process each base theme.
// Ensure that we start with the root of the parents, so that both CSS files
// and preprocess functions comes first.
foreach (array_reverse($this->theme->
getBaseThemeExtensions()) as $base) {