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.
In #1929136: Fix override-free context, move global config overrides back to an event listener we moved the override data to the config context opening the possible of not rereading configuration data from the database when switching context.
Comments
Comment #1
alexpottComment #2
pounardOn the other issue I proposed to always keep Config objects unchanged, and decorate them using the context instead (totally removing the override possibilty over the config object): this would solve this problem naturally: only context would carry overrides, and leaving context would drop those from memory too. It seems also cleaner because Config instances then represent the real stored configuration as it lives into files/datatabase.
This can be done multiple ways, there is one easy one but I'm not sure it's the best one:
* Create a ConfigInterface for config object, with setters and getters
* Implement this interface on both ContextInterface and Config class
* Add the Config object reference in the context instead of the other way (reverse the relationship) (question: is that bad?)
* Make it transparent for the user that when he calls config() he really fetches a context instead of a Config object, but use it as a Config object for get and set etc...
Comment #3
Gábor HojtsyTagging for performance.
Comment #4
alexpottThe config context system was removed in #2098119: Replace config context system with baked-in locale support and single-event based overrides