Feb 22, 2015

Beta 6: ConfigFactoryInterface::getEditable()

Migrating to D8 beta 6 (from beta 4), when I tried to submit a form to change a field value that is persisted by using the Simple Configuration API, I got the log error message,

Can not set values on immutable configuration ... Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() ...

As of beta 6, by default, the values of configuration objects cannot be changed. So the line of code from the previous release,

  $config = \Drupal::config('optimizely.settings');

had to be replaced with the following in order to retrieve a mutable object.

  $config =

Calls to get() and set() then work as expected.

  $id = $config->get('optimizely_id');

  $config->set('optimizely_id', $id);


Configuration objects by default are immutable.

Working with Configuration Forms

Functions variable_set() and variable_get() are removed