Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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:
- Use config instead of conf.
- Convert all instances of a new designated delimiter to ']['. I think ~ is a good choice because it's in the Unreserved Characters list.
- Update the documentation on the site config form, Variables, to explain use of the delimiter for Drupal 8 and include it in the examples.
Comment | File | Size | Author |
---|---|---|---|
#7 | hosting_variables-drupal_8_config_support-2796619-7.patch | 3.37 KB | Grimreaper |
Comments
Comment #2
GrimreaperHello,
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.
Comment #4
colanTo 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:
But you probably shouldn't be changing these anyway. So this is good enough for now.
Comment #5
colanComment #6
GrimreaperHello @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.
Comment #7
GrimreaperHere 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.
Comment #8
colanCode looks great, thanks! I'll test this shortly.
Comment #10
colanWorks fine for me.
Comment #11
GrimreaperThanks for the commit.