Find a way to set language context without creating user.

Code need to be updated:

  $user_config_context = config_context_enter('Drupal\user\UserConfigContext');
  $account = new User(array('langcode' => $language->langcode), 'user');
  $user_config_context->setAccount($account);

see #1970534-6: Patch testing issue

CommentFileSizeAuthor
#1 20202347-context-change-1.patch936 bytesvijaycs85
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vijaycs85’s picture

Title: Update config_translation_enter_context with language context instead of creating User. » Update config_translation_enter_context with User entity instead of context instead of creating User object
Status: Active » Needs review
FileSize
936 bytes

Checked few context related meta and tried adding LanguageConfigcontext. But doesn't look we would get it any time soon. So updating another option that fix saving context for now.

Once LanguagConfigContext landed, we can replace this.

YesCT’s picture

Gábor Hojtsy’s picture

Title: Update config_translation_enter_context with User entity instead of context instead of creating User object » Temporary fix for config_translation_enter_context until language context becomes an option
Status: Needs review » Fixed

Very tricky and clever hack :D Thanks, committed. We should really get #2020361: Create LanguageConfigContext to activate configuration overrides based on language land and remove this hack though :) Other modules reacting to a user context may react to this user in ways we did not intend. It will work temporarily in the meantime until then.

vijaycs85’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

adding pointer to helper issue.