Drupal 8 - ConfigFormBase and overrides caution

Submitted by superadmin on Sun, 12/27/2015 - 18:04

Drupal 8 makes a good attempt to stop overrides provided in places like settings.php from bleeding into configuration forms that will be exported. By default config objects obtained from Drupal::config can contain overrides from settings.php. However in the config object returned by ConfigFormBase::config() overrides are disabled and the data fetched from this object are the raw configurations. This could be dangerous when you want toggle between configuration between dev environment and production i.e. setting the site email address to a development inbox.

After looking at the code behind the method it seems that this behavior only occurs when you you use a config name that is returned from getEditableConfigNames. However this is not something you could control as it will be part of a codebase of other contrib modules.

See this core issue for more information.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.