function _install_config_locale_overrides_process_batch

Same name in other branches
  1. 9 core/includes/install.core.inc \_install_config_locale_overrides_process_batch()
  2. 11.x core/includes/install.core.inc \_install_config_locale_overrides_process_batch()

Batch operation callback for install_config_locale_overrides().

Parameters

array $names: The configuration to process.

array $langcodes: The langcodes available on the site.

$context: The batch context.

1 string reference to '_install_config_locale_overrides_process_batch'
_install_config_locale_overrides in core/includes/install.core.inc
Creates a batch to process config translations after installing from config.

File

core/includes/install.core.inc, line 2552

Code

function _install_config_locale_overrides_process_batch(array $names, array $langcodes, &$context) {
    // Get the services we need.
    $language_manager = \Drupal::languageManager();
    
    /** @var \Drupal\locale\LocaleConfigManager $locale_config_manager */
    $locale_config_manager = \Drupal::service('locale.config_manager');
    
    /** @var \Drupal\locale\LocaleConfigSubscriber $locale_config_subscriber */
    $locale_config_subscriber = \Drupal::service('locale.config_subscriber');
    foreach ($names as $name) {
        $active_langcode = $locale_config_manager->getActiveConfigLangcode($name);
        foreach ($langcodes as $langcode) {
            if ($langcode === $active_langcode) {
                $config = \Drupal::config($name);
            }
            else {
                $config = $language_manager->getLanguageConfigOverride($langcode, $name);
            }
            $locale_config_subscriber->updateLocaleStorage($config, $langcode);
        }
    }
    $context['finished'] = 1;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.