function LocaleExtensionHooks::extensionsInstalled
Same name and namespace in other branches
- main core/modules/locale/src/Hook/LocaleExtensionHooks.php \Drupal\locale\Hook\LocaleExtensionHooks::extensionsInstalled()
Implements hook_modules_installed().
Implements hook_themes_installed().
Attributes
File
-
core/
modules/ locale/ src/ Hook/ LocaleExtensionHooks.php, line 34
Class
- LocaleExtensionHooks
- Extension hook implementations for locale.
Namespace
Drupal\locale\HookCode
public function extensionsInstalled(array $extensions) : void {
// Skip running the translation imports if in the installer,
// because it would break out of the installer flow. We have
// built-in support for translation imports in the installer.
if (!InstallerKernel::installationAttempted() && locale_translatable_language_list()) {
if ($this->configFactory
->get('locale.settings')
->get('translation.import_enabled')) {
// Update the list of translatable projects and start the import batch.
// Only when new projects are added the update batch will be triggered.
// Not each enabled module will introduce a new project. E.g. sub
// modules.
$projects = array_keys($this->localeProjectRepository
->buildProjects());
if ($extensions = array_intersect($extensions, $projects)) {
// Get translation status of the projects, download and update
// translations.
$options = LocaleDefaultOptions::updateOptions();
$batch = $this->localeFetch
->buildUpdateBatch($extensions, [], $options);
batch_set($batch);
}
}
// Construct a batch to update configuration for all components.
// Installing this component may have installed configuration from any
// number of other components. Do this even if import is not enabled
// because parsing new configuration may expose new source strings.
if ($batch = $this->localeConfigBatch
->buildBatch([], [], [], TRUE)) {
batch_set($batch);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.