Problem/Motivation
+++ b/core/includes/config.incundefined
@@ -99,6 +108,54 @@ function config($name) {
+function config_context_enter($context_name) {
+ if (drupal_container()->has($context_name)) {
+ $context = drupal_container()->get($context_name);Could move to a container-aware service.
Proposed resolution
Move to a container-aware service.
Remaining tasks
- implement the move
User interface changes
No UI changes.
API changes
Yes?
Original report by @catch
Follow up for #1763640-207: Introduce config context to make original config and different overrides accessible and #212
+++ b/core/includes/config.incundefined
@@ -99,6 +108,54 @@ function config($name) {
+function config_context_enter($context_name) {
+ if (drupal_container()->has($context_name)) {
+ $context = drupal_container()->get($context_name);
@catch:
This looks like it could move to a container-aware service?
#212
@alexpott:
@catch said on irc that moving config_context_enter() to a container-aware service could be explored in a later patch.
Comments
Comment #1
yesct commentedpostponed on #1763640: Introduce config context to make original config and different overrides accessible
Comment #2
gábor hojtsy#1763640: Introduce config context to make original config and different overrides accessible landed now. It would be great if @catch could elaborate on this suggestion. I understand it is about making the function be able to work with a container provided as an argument (such as for testing?). Is that the suggestion?
Comment #3
gábor hojtsyComment #4
tim.plunkettIt could just be a means of returning a context-driven config factory. But it so uncommonly used so far, we should just have everyone get it injected.
Taken from #1925660: Convert system's system_config_form() to SystemConfigFormBase:
Comment #5
alexpottI like the look of #4 - makes sense and is clean... once all forms are converted to ConfigFormBase we can get rid of config_context_enter()
Comment #6
alexpott#1938338: Replace drupal_container() in Configuration system actually cleans up config_context_enter to use Drupal::service()
Comment #7
gábor hojtsyDoes that help with this issue or makes this a duplicate? :)
Comment #8
alexpottre #7 I was undecided... I think we should won't fix this issue due to #1924990: [meta] Convert all of system_config_form() to SystemConfigFormBase and #1938338: Replace drupal_container() in Configuration system... it may well be possible to completely remove config_context_enter() once all the forms are converted. Or we might choose to have a procedural function as a helper and the version in #1938338: Replace drupal_container() in Configuration system is what we want.