Description

Module and themes settings previously stored and retrieved from the variables table are now stored and retrieved from configuration (CMI). Variable_get, variable_set, and variable_del are no longer supported.

Examples

Instead of:

$variable = variable_get('foo', 'bar');
variable_set('foo', $variable);
variable_del('foo');

Use CMI

$variable = config_get('mymodule.settings', 'foo');
config_set('mymodule.settings', 'foo', $variable);

$config = config('mymodule.settings');
$config->clear('foo');
$config->save();

And coming soon:
config_del('mymodule.settings', 'foo');

The above will read and write to a JSON file called mymodule.settings.json in the active config directory.

Every time you call config_get() or config_set(), it hits the disk to read/write the file. If you're doing a lot of reads or writes, it's better to do all the reads at once and all the writes at once like this:

$config = config('mymodule.settings');
$value = $config->get('foo');

// Some code to determine new $value.

$config->set('foo', $value);
$config->set('baz', 'boo');
$config->save();

Modules will also need to declare information about config files in hook_config_info(). Further configuration documentation can be found in config.api.php

Example

/**
* Implements hook_config_info().
*/
function contact_config_info() {
  $prefixes['contact.settings'] = array(
    'label' => t('Contact settings'),
    'group' => t('Contact'),
  );
  $prefixes['contact.categories'] = array(
    'label' => t('Contact categories'),
    'group' => t('Contact'),
  );
  return $prefixes;
}
Introduced in branch: 
1.0.x
Introduced in version: 
1.0.0
Impacts: 
Module developers
Theme developers
Related Github Issues: 
https://github.com/backdrop/backdrop-issues/issues/386