diff --git a/config_translation.module b/config_translation.module index 656ee3d..520b108 100644 --- a/config_translation.module +++ b/config_translation.module @@ -9,7 +9,6 @@ use Drupal\Core\Config\Schema\Element; use Drupal\Core\Language\Language; use Drupal\config_translation\ConfigGroupMapper; use Drupal\config_translation\ConfigEntityMapper; -use Drupal\user\Plugin\Core\Entity\User; /** * Implements hook_help(). @@ -381,20 +380,3 @@ function config_translation_page_alter(&$page) { } } } - -/** - * Uses a dummy user to get overrides for a specific language. - * - * @param \Drupal\Core\Language\Language $language - * A language object. - */ -function config_translation_enter_context($language) { - global $user; - // Load current user object. - $account = user_load($user->uid); - // Clone to make language specific changes and not affect current user. - $context_user_account = clone $account; - $context_user_account->set('preferred_langcode', $language->langcode); - // Enter context with updated langcode. - config_context_enter('Drupal\user\UserConfigContext')->setAccount($context_user_account); -} diff --git a/lib/Drupal/config_translation/Controller/ConfigTranslationController.php b/lib/Drupal/config_translation/Controller/ConfigTranslationController.php index 35fef56..4a6c9e0 100644 --- a/lib/Drupal/config_translation/Controller/ConfigTranslationController.php +++ b/lib/Drupal/config_translation/Controller/ConfigTranslationController.php @@ -162,7 +162,7 @@ class ConfigTranslationController implements ControllerInterface { // Enter context for the translation target language requested and generate // form with translation data in that language. - config_translation_enter_context($language); + config_context_enter('Drupal\language\LanguageConfigContext')->setLanguage($language); $locale_storage = \Drupal::service('locale.storage'); return drupal_get_form(new ConfigTranslationManageForm($locale_storage), $group, $language, $base_config); }