function BlockHooks::themesInstalled
Implements hook_themes_installed().
Initializes blocks for installed themes.
Attributes
#[Hook('themes_installed')]
Parameters
string[] $theme_list: An array of theme names.
See also
BlockHooks::modulesInstalled()
File
-
core/
modules/ block/ src/ Hook/ BlockHooks.php, line 183
Class
- BlockHooks
- Hook implementations for block.
Namespace
Drupal\block\HookCode
public function themesInstalled($theme_list) : void {
// Do not create blocks during config sync.
if (\Drupal::service('config.installer')->isSyncing()) {
return;
}
// Disable this functionality prior to install profile installation because
// block configuration is often optional or provided by the install profile
// itself. block_theme_initialize() will be called when the install profile
// is installed.
if (InstallerKernel::installationAttempted() && \Drupal::config('core.extension')->get('module.' . \Drupal::installProfile()) === NULL) {
return;
}
foreach ($theme_list as $theme) {
// Don't initialize themes that are not displayed in the UI.
if (\Drupal::service('theme_handler')->hasUi($theme)) {
block_theme_initialize($theme);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.