Problem/Motivation
Since Drupal 10.2, form elements in configuration forms can use the #config_target property to indicate when their values are overridden, for example in settings.php. See https://www.drupal.org/node/3373502.
In the Stripe API module, configuration values can be overridden using environment-specific values in settings.php. However, the admin form does not currently reflect these overrides. This can lead to confusion, as the UI displays values that do not reflect what the site is actually using.
Steps to reproduce
1. Override $config['stripe_api.settings'] in settings.php
2. Visit /admin/config/services/stripe_api.
3. Notice that there is no indication that the value is overridden.
Proposed resolution
Add #config_target to relevant form elements in the admin form, starting with those that are most likely to be overridden. This will allow Drupal to indicate when a value is being controlled outside the UI, improving clarity for administrators and developers.
With this in place, the UI will indicate that the value is overridden, helping to prevent misinterpretation of the current configuration.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3537659-add-config-target-to-the-admin-form-3.patch | 772 bytes | colinstillwell |
Issue fork stripe_api-3537659
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
colinstillwell commentedI've attached a patch that adds
#config_targetto themodefield in the Stripe admin form.This change addresses a specific use case on my site, where we override
$config['stripe_api.settings']['mode']insettings.phpbased on the environment.At this stage, I have only applied the change to the
modefield. This was intentional, as it's the setting relevant to my current use case. I wanted to open the conversation first and confirm that the community agrees with this approach before applying it more broadly.If others support this direction, I would be happy to invest more time in extending
#config_targetto other relevant form elements within the module.Looking forward to your feedback.
Comment #4
grasmash commented