diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index 4edbead..335d083 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -161,13 +161,16 @@ public function getContext() { * The config factory object. */ public function leaveContext() { + // Ensure at least one context is left on the stack. We already ensured + // there is at least one context set by taking the initial one in the + // constructor. if (count($this->contextStack) > 1) { array_pop($this->contextStack); } return $this; } - /* + /** * Gets the cache key for a given config name in a particular context. * * @param string $name diff --git a/core/lib/Drupal/Core/Config/Context/ContextInterface.php b/core/lib/Drupal/Core/Config/Context/ContextInterface.php index b3107a7..4361bfe 100644 --- a/core/lib/Drupal/Core/Config/Context/ContextInterface.php +++ b/core/lib/Drupal/Core/Config/Context/ContextInterface.php @@ -22,7 +22,7 @@ */ interface ContextInterface { - /* + /** * Initialises a config context for use. * * Creates a unique context identifier, adds data and notifies system about diff --git a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php index b7b281b..8429d2a 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php @@ -25,6 +25,7 @@ * $config is always a DrupalConfig object. */ class LocaleConfigSubscriber implements EventSubscriberInterface { + /** * The language manager. * @@ -32,6 +33,11 @@ class LocaleConfigSubscriber implements EventSubscriberInterface { */ protected $languageManager; + /** + * Default configuration context. + * + * @var \Drupal\Core\Config\Context\ContextInterface + */ protected $defaultConfigContext; /** @@ -56,7 +62,9 @@ public function __construct(LanguageManager $language_manager, ContextInterface public function configContext(ConfigEvent $event) { $context = $event->getContext(); - // Add user's language for user context. + // If there is a user set in the current context, set the language based on + // the preferred language of the user. Otherwise set it based on the + // negotiated interface language. if ($account = $context->get('user.account')) { $context->set('locale.language', language_load(user_preferred_langcode($account))); } @@ -84,6 +92,12 @@ public function configLoad(ConfigEvent $event) { } } + /** + * Set the negotiated interface language on the default configuration context. + * + * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent + * Kernel event to respond to. + */ public function onKernelRequestSetDefaultConfigContextLocale(GetResponseEvent $event) { if ($language = $this->languageManager->getLanguage(LANGUAGE_TYPE_INTERFACE)) { $this->defaultConfigContext->set('locale.language', $language); diff --git a/core/modules/user/lib/Drupal/user/UserConfigContext.php b/core/modules/user/lib/Drupal/user/UserConfigContext.php index d6e4114..cd25f19 100644 --- a/core/modules/user/lib/Drupal/user/UserConfigContext.php +++ b/core/modules/user/lib/Drupal/user/UserConfigContext.php @@ -34,7 +34,7 @@ public function setUuid() { $this->uuid = $this->get(self::USER_KEY)->uuid(); } - /* + /** * Helper function to create config context for user accounts. * * @param \Drupal\user\Plugin\Core\Entity\User $account