function BlockHooks::modulesInstalled
Same name and namespace in other branches
- 11.x core/modules/block/src/Hook/BlockHooks.php \Drupal\block\Hook\BlockHooks::modulesInstalled()
Implements hook_modules_installed().
Attributes
#[Hook('modules_installed')]
See also
File
-
core/
modules/ block/ src/ Hook/ BlockHooks.php, line 154
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;
}
// BlockHooks::themesInstalled() 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.