function BlockHooks::modulesInstalled
Implements hook_modules_installed().
Attributes
#[Hook('modules_installed')]
See also
File
-
core/
modules/ block/ src/ Hook/ BlockHooks.php, line 153
Class
- BlockHooks
- Hook implementations for block.
Namespace
Drupal\block\HookCode
public function modulesInstalled($modules, bool $is_syncing) : void {
// Do not create blocks during config sync.
if ($is_syncing) {
return;
}
// block_themes_installed() does not call block_theme_initialize() during
// site installation because block configuration can be optional or provided
// by the profile. Now, when the profile is installed, this configuration
// exists, call block_theme_initialize() for all installed themes.
$profile = \Drupal::installProfile();
if (in_array($profile, $modules, TRUE)) {
foreach (\Drupal::service('theme_handler')->listInfo() as $theme => $data) {
block_theme_initialize($theme);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.