Skip to main content
5 of 6
deleted 16 characters in body
4uk4
  • 101.7k
  • 7
  • 173
  • 217

In a configuration form use $this->config() and not \Drupal::config().

The difference between both is that the configuration form uses immutable configuration.

When Drupal 8 was in beta, the immutable configuration was introduced to avoid bleeding of overridden values into configuration when saved to the database. See the change record:

Configuration objects by default are immutable

This is the code executed by $this->config() of a configuration form:

\Drupal::configFactory()->getEditable('system.site')->set('name', 'My fantastic site')->save();

For Drupal 8.7 it is discussed to display a warning for overridden values:

This form contains values that have been overridden. Changes to these values can still be saved, but the overridden values will take precedence. Overrides are as follows ...

See the issue:

There is no indication on configuration forms if there are overridden values

4uk4
  • 101.7k
  • 7
  • 173
  • 217