Problem/Motivation
Code that must be able to store the configuration of plugins of different types in CMI, have no way to reference the schemas of those plugins' configuration in their own configuration schemas. To work around this, I created the plugin.plugin_configuration.$plugin_type_id.$plugin_id format convention as documented in the Plugin module.
However, as Drupal core, and likely many contributed modules as well, do not adhere to this format, the configuration schemas of plugins from these projects cannot be referenced generically.
At DrupalCamp Vienna, @alexpott and @Xano discussed the idea of aliasing schemas, which will essentially allow schemas to exist under multiple names. Example:
plugin.plugin_configuration.block.*
type: block_settings.*
These aliases work well in Drupal 8.0.x, but wildcard values are not passed. This means that with this schema, lookups for plugin.plugin_configuration.block.foobar will result in the schema for block_settings.* being loaded instead of the schema for block_settings.foobar.
Proposed resolution
Resolve schema types by passing on wildcard values from 'parent' types to 'child' types.
Remaining tasks
To be determined.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | drupal_2629640_3.patch | 8.54 KB | xano |
| #3 | interdiff.txt | 6.21 KB | xano |
Comments
Comment #2
xanoThis is a quick proof of concept.
Comment #3
xanoNow with tests. I fixed a small bug that the tests exposed.
Comment #4
xanoFor the Plugin module I realized that CMI currently already facilitates dynamic schema types, as long as the dynamic values are contained by the same config object that defines the dynamic schema name. I used this to store the entire config schema name in a config property, and use that as the type of another property contained by the same config object. See #2543420: Add schemas for core plugins' configuration.
Comment #5
xanoAdding a related issue for those who came here via the Plugin module.
Comment #6
berdirI think this was resolved by #2392057: Config schema fails to expand dynamic top-level types?
Comment #7
xanoI looked at it briefly and it doesn't look like it handles replacements for wildcards.
Comment #22
smustgrave commentedWith the changes in D9 + D10 wonder if this is still relevant?
Before anyone works on rerolling or updating.
Comment #24
smustgrave commentedSince there has been no follow up going to close for now.
If still a valid request please reopen though, maybe updating issue summary for what needs to be done for D10+
Thanks all!