Problem/Motivation
Drupal core recently added the concept of "optional" config. This is config data with dependencies that are optional. If the dependencies are not met, the module is still enabled without the optional config. If the dependent module is later enabled, then the optional config is installed.
Features needs a UI mechanism to mark certain config as "optional" to be stored in /config/optional rather than in /config/install
Proposed resolution
Rather than marking individual config items as optional, it might be better to have a section for "optional dependencies". For example, if we are exporting a View and we put "views" into the optional-dependency group instead of the normal dependency group, then any exported config that depends on views would be saved to /config/optional.
This allows us to handle optional config from the module dependency perspective rather that from the detailed config component perspective.
User interface changes
Add a "optional dependency" component that has the list of checkboxes for each current module dependency (initially unchecked). If the optional dependency is checked, it is unchecked in the normal dependency list. If it is checked in the normal dependency list, it gets unchecked from the optional list.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | features-optional-plugin-2532958-3.patch | 6.9 KB | nedjo |
Comments
Comment #1
nedjoI'm thinking initially this should be a new assignment plugin, 'optional'.
InstallStorage::CONFIG_INSTALL_DIRECTORY.InstallStorage::CONFIG_OPTIONAL_DIRECTORY.For example: if 'view' is designated as an optional config type, all config of type 'view' will be assigned to
InstallStorage::CONFIG_OPTIONAL_DIRECTORY.This approach will also facilitate integration with Configuration Share, which stores configuration in config/shared; see #2447703: Integrate with Configuration Share and Compatible.
Comment #3
nedjoIn #2 I refactored to allow designating of a target subdirectory for given pieces of config.
And here's a patch adding a new assignment plugin that allows selection of types of configuration that should be optional.
Contrary to what I suggested above, it doesn't need a particularly low weight, since it doesn't actually assign any configuration to packages--it just sets the directory that configuration will be exported to, if it's assigned to a package.
TBD: what, if any, types of configuration should be designated optional by default? For now, I haven't set any.
Comment #4
nedjoComment #6
nedjoI went ahead and applied this. If and as we determine what configuration types should be optional by default, we can set them in new issues.