Rename Drupal::config to imply immutable object

Created on 19 March 2015, over 9 years ago
Updated 12 May 2024, 4 months ago

Problem/Motivation

In the process of trying to update one of my modules, I found out that \Drupal::config() now returns an immutable object (and trying to figure out what I need to call to get the editable config object was a bit lost).

I really like that we now have differentiation when dealing with an immutable vs. editable state of configuration. However, it is problematic because config() on its own is ambiguous since we now have multiple states.

Proposed Resolution

Since we are considering having a static function getEditable() or editableConfig() to get an editable state of configuration, create a function \Drupal::immutableConfig() that (hopefully) replaces \Drupal::config. It makes things more clear that we are dealing with read-only configuration.

✨ Feature request
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
OtherΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States BTMash

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    @BTMash, thanks for helping to improve Drupal.

    The class \Drupal\Core\Config\ImmutableConfig was added to core on 2015-01-16, a few months before this issue was created. And that, I think, resolves the problem stated in the Issue Summary.

    Cheers

Production build 0.71.5 2024