Problem/Motivation
Errors related to config keys not supporting dots.
ie,
XMLSitemap Settings form:
Drupal\Core\Config\ConfigValueException: xmlsitemap.settings key contains a dot which is not supported. in Drupal\Core\Config\ConfigBase->validateKeys() (line 209 of core/lib/Drupal/Core/Config/ConfigBase.php).
PathAuto Settings form:
Drupal\Core\Config\ConfigValueException: pathauto.settings key contains a dot which is not supported. in Drupal\Core\Config\ConfigBase->validateKeys() (line 209 of core/lib/Drupal/Core/Config/ConfigBase.php).
Steps to reproduce
- Install a clean instance of Drupal
- Install and enable config enforce and config enforce devel
- Install and enable xmlsitemap and/or pathauto, try to config enforce and save their setting forms
Proposed resolution
After some debugging, the submission of those forms don't save the config used only for the original setting form, but instead takes all the values of the form state, and form state includes the config enforce values using as key probably the schema identifier of the module/form ---- in the examples above will be pathauto.settings and/or xmlsitemap.settings, causing the not allowed dots in configuration keys.
The resolution will be not to assume the the original config form will only handle their own values, so moving the config enforce values from the form state values is the approach.
- Include a submit handler to make sure to catch the form state values first.
- On config enforce or form submission, move the config enforce values out of the form state values.
- The original config form submission will process the data without the config enforce values.
- Return the config enforce values to the form state values before the config enforce submit process.
Probably there is a more elegant way, but this was a quick fix.
User interface changes
none
API changes
none
Data model changes
none
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | config_enforce_devel-Error_key_contains_dot-3550518-2.patch | 2.24 KB | blanca.esqueda |
Comments
Comment #2
blanca.esqueda commentedPatch for the configuration key contains a dot error
Comment #3
star-szrBoth errors are fixed in 2.0.x because of #3188474: Move the config_enforce form to an off-canvas dialog.
While testing I found separate issues with each module:
The xmlsitemap settings for individual entity/bundle settings (for example
/admin/config/search/xmlsitemap/settings/node/page) only show the global xmlsitemap.settings config, but that is a separate issue, and seems to be because xmlsitemap's XmlSitemapLinkBundleSettingsForm only returnsxmlsitemap.settings. I don't think we should special-case every contrib module, so that would be one to use the "Generate from active storage" feature.Pathauto doesn't seem to have this issue, but does have a separate bug which I've made an issue for: #3559287: DevelEnforceFormHandler cannot be serialized: bugs on config forms that use AJAX