Currently, this module writes Drupal 7 configuration, but not Drupal 8. To use the module effectively on Drupal 8 sites, we'll need to convert lines like:

$conf['site_name'] = 'My Drupal site';

...to:

$config['system.site']['name'] = 'My Drupal site';

It's only the part before the equal sign that changes. So we should do the following:

  1. Use config instead of conf.
  2. Convert all instances of a new designated delimiter to ']['. I think ~ is a good choice because it's in the Unreserved Characters list.
  3. Update the documentation on the site config form, Variables, to explain use of the delimiter for Drupal 8 and include it in the examples.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

colan created an issue. See original summary.

Grimreaper’s picture

Hello,

May I suggest to also support $settings, which stores environment specific variables as explained in https://anavarre.net/from-conf-to-config-and-settings-in-drupal-8/

It may be useful to set up a Redis backend for example.

  • colan committed 3f44b71 on 7.x-1.x
    Issue #2796619 by colan: Spun out function to determine variable...
  • colan committed 5e740b1 on 7.x-1.x
    Issue #2796619 by colan: Merge branch 'issue-2796619' into 7.x-1.x
    
  • colan committed 83a2ea7 on 7.x-1.x
    Issue #2796619 by colan: Added support for the hierarchical...
  • colan committed ed9575c on 7.x-1.x
    Issue #2796619 by colan: Added functions for formatting the variable...
colan’s picture

Status: Active » Fixed

To account for #2, $settings will be used instead of $config when the variable is not hierarchical (i.e. there are no tilde characters).

This will work in most cases, but not if you want to change the following, which are exceptions in that they are in fact hierarchical:

  • $settings['container_yamls']
  • $settings['trusted_host_patterns']

But you probably shouldn't be changing these anyway. So this is good enough for now.

colan’s picture

Grimreaper’s picture

Hello @colan,

Thanks for the commits.

I am currently testing it.

I don't think hierarchical $settings are exceptional. By example Redis use $settings in a hierarchical way: http://cgit.drupalcode.org/redis/tree/README.md#n36

I will see for a way to handle both cases.

Grimreaper’s picture

Status: Fixed » Needs review
FileSize
3.37 KB

Here is a patch that add a better support for $settings.

Now by prefixing the variable name with 'config||' or 'settings||' you can distingate the subsystem.

Thanks for the review.

colan’s picture

Code looks great, thanks! I'll test this shortly.

  • colan committed b835600 on 7.x-1.x authored by Grimreaper
    Issue #2796619 by Grimreaper: Added support for Drupal 8 settings-style...
colan’s picture

Status: Needs review » Fixed

Works fine for me.

Grimreaper’s picture

Thanks for the commit.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.