Last updated October 18, 2012. Created by heyrocker on August 29, 2012.
Edited by LinL. Log in to edit this page.
File storage
All configuration data will be stored on-disk using YAML files. In a fresh Drupal installation two directories will be created:
- Active: This stores your currently live configuration.
- Staging: This stores configuration that is ready to be imported.
Both of these directories will live inside a randomly named directory that lives inside your files directory.
Individual configuration files (prefix.example.yml) will look like the following:
some_string: Woo kittens!
some_int: '42'
some_bool: '1'Configuration can also be nested, here is what the standard core 'thumbnail' image style looks like:
name: thumbnail
label: Thumbnail (100x100)
effects:
1cfec298-8620-4749-b100-ccb6c4500779:
name: image_scale
data:
width: '100'
height: '100'
upscale: '1'
weight: '0'
ieid: 1cfec298-8620-4749-b100-ccb6c4500779How these files are organized and named will vary depending on use cases. Standard settings will be in files like statistics.settings.yml, and something like image module which other modules hook into to provide "discoverable" stuff might do both a module-specific configuration file image.settings.yml for "global" module settings, as well as provide image.style.$style_name.yml files.
Data in these files will be stored in a pluggable cache implementing the standard Drupal CacheBackendInterface.
Configuration API
At this level are the actual API functions that module developers will interact with in order to manipulate configuration values; essentially, a replacement for variable_get()/variable_set().
// Load a set of configuration out of the active store.
// 'prefix.name' refers to the filename of the .yml file, without the extension.
$config = config('prefix.name');
// Access a single value out of the store.
echo $config->get('my.value');
// Change a value and save it back to both the active store and the filesystem.
$config->set('my.value','my new value');
$config->save();The next chapter explains these APIs in detail.