diff --git a/core/includes/config.inc b/core/includes/config.inc index 4ce1b5a..0b01073 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -56,7 +56,7 @@ function config_get_storage_names_with_prefix($prefix = '') { * @code config(book.admin) @endcode will return a configuration object in which * the book module can store its administrative settings. * - * @param $name + * @param string $name * The name of the configuration object to retrieve. The name corresponds to * a configuration file. For @code config(book.admin) @endcode, the config * object returned will contain the contents of book.admin configuration file. @@ -69,9 +69,11 @@ function config($name) { } /** - * Retrieves a configuration object for administration. This means that it has a special - * configuration context (admin = TRUE) and configuration plug-ins should mostly keep hands - * off this object and don't override it. + * Retrieves a configuration object for administration. + * + * This configuration object has a special configuration context (admin = TRUE) + * and configuration plug-ins should mostly keep hands off this object and don't + * override it. * * @param $name * The name of the configuration object to retrieve. @@ -91,14 +93,21 @@ function config_admin($name) { * Retrieves a configuration factory object for a given context. * * @param array $context - * Array with contextual data to be used for the configuration factory. + * (optional) Array with contextual data to be used for the configuration + * factory. Defaults to an empty array. * @param Drupal\Core\Config\StorageInterface $storage - * The storage controller object to use for reading and writing - * configuration data. + * (optional) The storage controller object to use for reading and writing + * configuration data. Defaults to the storage controller object registered + * in the Drupal Container. * @param Symfony\Component\EventDispatcher\EventDispatcher - * An event dispatcher instance to use for configuration events. + * (optional) An event dispatcher instance to use for configuration events. + * Defaults to the event dispatcher instance registered in the Drupal + * Container. + * + * @return Drupal\Core\Config\ConfigFactory + * Configuration factory object. */ -function config_factory($context = array(), StorageInterface $storage = NULL, EventDispatcher $event_dispatcher = NULL) { +function config_factory(array $context = array(), StorageInterface $storage = NULL, EventDispatcher $event_dispatcher = NULL) { $storage = $storage ? $storage : drupal_container()->get('config.storage'); $event_dispatcher = $event_dispatcher ? $event_dispatcher : drupal_container()->get('dispatcher'); $factory = new ConfigFactory($storage, $event_dispatcher); diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index c594c4b..247af2d 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -74,7 +74,9 @@ class Config { * A storage controller object to use for reading and writing the * configuration data. * @param Drupal\Core\Config\ConfigFactory $factory - * A configuration factory object that produces this config object. + * (optional) A configuration factory object that produces this config + * object. Defaults to the storage controller object registered in the + * Drupal Container. */ public function __construct($name, StorageInterface $storage, ConfigFactory $factory = NULL) { $this->name = $name; @@ -372,14 +374,20 @@ class Config { } /** - * Retrieve the configuration factory used to create this configuration object. + * Retrieves the configuration factory that produces this configuration object. + * + * @return Drupal\Core\Config\ConfigFactory + * A configuration factory that produces this configuration object. */ public function getFactory() { return $this->factory; } /** - * Dispatch a config event. + * Dispatches a config event. + * + * @param $config_event_name + * Event name. */ protected function notify($config_event_name) { $this->factory->notify($config_event_name, $this); diff --git a/core/lib/Drupal/Core/Config/ConfigEvent.php b/core/lib/Drupal/Core/Config/ConfigEvent.php index 9449404..710f51f 100644 --- a/core/lib/Drupal/Core/Config/ConfigEvent.php +++ b/core/lib/Drupal/Core/Config/ConfigEvent.php @@ -14,7 +14,12 @@ class ConfigEvent extends Event { protected $config; /** - * Constructor. + * Constructs a configuration event object. + * + * @param Drupal\Core\Config\Config + * Configuration object. + * @param Drupal\Core\Config\ConfigFactory + * Configuration factory object. */ public function __construct(Config $config, ConfigFactory $factory) { $this->config = $config; @@ -30,6 +35,9 @@ class ConfigEvent extends Event { /** * Get configuration factory object. + * + * @return Drupal\Core\Config\ConfigFactory + * Configuration factory object. */ public function getFactory() { return $this->factory; diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index e09068e..a2b4b51 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -96,6 +96,9 @@ class ConfigFactory { /** * Get storage controller. + * + * @return Drupal\Core\Config\StorageInterface + * A storage controller instance for reading and writing configuration data. */ public function getStorage() { return $this->storage; @@ -104,10 +107,11 @@ class ConfigFactory { /** * Gets data from this config context. * - * @param $key - * A string that maps to a key within the context data or empty to get all data. + * @param string $key + * (optional) A string that maps to a key within the context data or empty + * to get all data. * - * @return + * @return array * The data that was requested. */ public function getContext($key = '') { @@ -124,9 +128,11 @@ class ConfigFactory { * * @param $key * A string that maps to a key within the configuration context. - * * @param $value * Any value to be set for this key. + * + * @return Drupal\Core\Config\ConfigFactory + * This ConfigFactory instance. */ public function setContext($key, $value) { $this->context[$key] = $value; @@ -134,9 +140,9 @@ class ConfigFactory { } /** - * Dispatch a config event. + * Dispatches a config event. * - * @param $config_event_name + * @param string $config_event_name * Event name. * @param Drupal\Core\Config\Config * Configuration object. diff --git a/core/modules/config/config.api.php b/core/modules/config/config.api.php index bd7212c..558ee08 100644 --- a/core/modules/config/config.api.php +++ b/core/modules/config/config.api.php @@ -125,15 +125,15 @@ function hook_config_import_delete($name, $new_config, $old_config) { } /** - * Delete configuration upon synchronizing configuration changes. + * Deletes configuration upon synchronizing configuration changes. * - * This callback is invoked when a new configuration factory is created - * and allows a module to take over the synchronization of configuration data. + * This callback is invoked when a new configuration factory is created and + * allows a module to take over the synchronization of configuration data. * * Modules should implement this callback if they manage configuration data - * (such as image styles, node types, or fields) which needs to be - * prepared and passed through module API functions to properly handle a - * configuration change. + * (such as image styles, node types, or fields) which needs to be prepared and + * passed through module API functions to properly handle a configuration + * change. * * @param Drupal\Core\Config\ConfigFactory $factory * A configuration object containing the new configuration data. @@ -145,4 +145,4 @@ function hook_config_factory($factory) { $factory->setContext('locale.language', user_preferred_language($account)); } } -} \ No newline at end of file +} diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 093cd41..e6f55d7 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -11,6 +11,7 @@ * Gettext portable object files are supported. */ +use Drupal\Core\Config\ConfigFactory; use Drupal\locale\LocaleLookup; use Drupal\locale\LocaleConfigSubscriber; use Drupal\locale\TranslationsStream; @@ -965,4 +966,4 @@ function locale_config_factory(ConfigFactory $factory) { $factory->setContext('locale.language', user_preferred_language($account)); } } -} \ No newline at end of file +} diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index bcf2bb8..ff854a3 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1595,7 +1595,7 @@ function system_logging_settings_submit($form, &$form_state) { */ function system_performance_settings($form, &$form_state) { drupal_add_library('system', 'drupal.system'); - $config = config('system.performance'); + $config = config_admin('system.performance'); $form['clear_cache'] = array( '#type' => 'fieldset', @@ -1681,7 +1681,7 @@ function system_performance_settings($form, &$form_state) { * @ingroup forms */ function system_performance_settings_submit($form, &$form_state) { - $config = config_admin('system.performance'); + $config = config('system.performance'); $config->set('cache.page.enabled', $form_state['values']['cache']); $config->set('cache.page.max_age', $form_state['values']['page_cache_maximum_age']); $config->set('response.gzip', $form_state['values']['page_compression']);