diff --git a/core/core.api.php b/core/core.api.php index ee32e87..7af4c08 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -283,13 +283,9 @@ * * The first task in using the simple configuration API is to define the * configuration file structure, file name, and schema of your settings (see - * @ref sec_yaml above). Once you have done that, you can retrieve the - * active configuration object that corresponds to configuration file - * mymodule.foo.yml with a call to: - * @code - * $config = \Drupal::config('mymodule.foo'); - * @endcode - * + * @ref sec_yaml above). To change configuration you will need to get an + * instance of Config by making a call to getEditable() on the config factory. + * You can do so like this: * This will be an object of class \Drupal\Core\Config\Config, which has methods * for getting and setting configuration information. For instance, if your * YAML file structure looks like this: @@ -307,11 +303,20 @@ * $bar = $config->get('bar'); * // Get one element of the array. * $bar_baz = $config->get('bar.baz'); - * // Update a value. Nesting works the same as get(). - * $config->set('bar.baz', 'string2'); - * // Nothing actually happens with set() until you call save(). - * $config->save(); + * + * @code + * $config = \Drupal::service('config.factory')->getEditable('mymodule.foo'); + * + * Individual configuration values can be unset using the clear() function, + * which is also chainable. + * @code + * $config = \Drupal::service('config.factory')->getEditable('system.performance'); + * $config->clear('cache.page.max_age')->save(); + * $page_cache_data = $config->get('cache.page'); * @endcode + * In this example $page_cache_data would return an array with one key - + * 'enabled' - because 'max_age' was unset. Whole configuration sets can be + * removed using the delete() function. * * @section sec_entity Configuration entities * In contrast to the simple configuration settings described in the previous