diff --git a/core/includes/config.inc b/core/includes/config.inc index 7dff3b3..b5ef28c 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -105,7 +105,7 @@ function config($name) { return drupal_container()->get('config.factory')->get($name); } -/* +/** * Sets the config context on the config factory. * * This allows configuration objects to be created using special configuration @@ -141,7 +141,7 @@ function config_context_enter($context_name) { return $context; } -/* +/** * Leaves the current config context returning to the previous context. * * @see config_context_enter() @@ -410,7 +410,7 @@ function config_get_entity_type_by_name($name) { return key($entities); } -/* +/** * Returns the typed config manager service. * * Use the typed data manager service for creating typed configuration objects. diff --git a/core/lib/Drupal/Core/Config/ConfigEvent.php b/core/lib/Drupal/Core/Config/ConfigEvent.php index c1df902..4d49312 100644 --- a/core/lib/Drupal/Core/Config/ConfigEvent.php +++ b/core/lib/Drupal/Core/Config/ConfigEvent.php @@ -42,7 +42,7 @@ public function getConfig() { } /** - * Get configuration context object. + * Gets configuration context object. * * @return \Drupal\Core\Config\Context\ContextInterface * Configuration context. diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index 0cd0382..3179b17 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -93,7 +93,7 @@ public function get($name) { */ public function reset($name = NULL) { if ($name) { - // Reinitialise the configuration object in all contexts. + // Reinitialize the configuration object in all contexts. foreach ($this->getCacheKeys($name) as $cache_key) { $this->cache[$cache_key]->init(); } @@ -162,13 +162,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 fae5d2d..46dbcbb 100644 --- a/core/lib/Drupal/Core/Config/Context/ContextInterface.php +++ b/core/lib/Drupal/Core/Config/Context/ContextInterface.php @@ -23,7 +23,7 @@ interface ContextInterface { /** - * Initialises a config context for use. + * Initializes a configuration context for use. * * @return \Drupal\Core\Config\Context\ConfigContext * The config context object. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php index 5788b36..cee642e 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php @@ -2,7 +2,7 @@ /** * @file - * Definition of \Drupal\config\Tests\ConfigLocaleOverride. + * Contains \Drupal\config\Tests\ConfigLocaleOverride. */ namespace Drupal\config\Tests; @@ -112,8 +112,8 @@ function testConfigLocaleUserOverride() { $config_factory = drupal_container()->get('config.factory'); $config_factory->enterContext($user_config_context->setAccount($account)); - // Should not have to re-initialise config object to get new overrides as - // the new context will have a different uuid. + // Should not have to re-initialize the configuration object to get new + // overrides as the new context will have a different uuid. $config = config('config_test.system'); $this->assertIdentical($config->get('foo'), 'de bar'); diff --git a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php index b7b281b..5a85399 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php @@ -1,7 +1,7 @@ languageManager = $language_manager; @@ -48,7 +54,7 @@ public function __construct(LanguageManager $language_manager, ContextInterface } /** - * Initialize configuration context with language. + * Initializes configuration context with language. * * @param \Drupal\Core\Config\ConfigEvent $event * The Event to process. @@ -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) { } } + /** + * Sets the negotiated interface language on the default configuration context. + * + * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event + * Kernel event to respond to. + */ public function onKernelRequestSetDefaultConfigContextLocale(GetResponseEvent $event) { if ($language = $this->languageManager->getLanguage(LANGUAGE_TYPE_INTERFACE)) { $this->defaultConfigContext->set('locale.language', $language); @@ -102,7 +116,7 @@ public function onKernelRequestSetDefaultConfigContextLocale(GetResponseEvent $e * The language object. * * @return string - * The localised config name. + * The localized config name. */ public function getLocaleConfigName($name, Language $language) { return 'locale.config.' . $language->langcode . '.' . $name; diff --git a/core/modules/user/lib/Drupal/user/UserConfigContext.php b/core/modules/user/lib/Drupal/user/UserConfigContext.php index 917787d..137b915 100644 --- a/core/modules/user/lib/Drupal/user/UserConfigContext.php +++ b/core/modules/user/lib/Drupal/user/UserConfigContext.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\user\UserConfigContext + * Contains \Drupal\user\UserConfigContext. */ namespace Drupal\user; @@ -26,8 +26,8 @@ class UserConfigContext extends ConfigContext { */ const USER_KEY = 'user.account'; - /* - * Helper function to create config context for user accounts. + /** + * Creates the configuration context for user accounts. * * @param \Drupal\user\Plugin\Core\Entity\User $account * The account to add to the config context.