This module allows other modules to define changes to installable configuration. These changes are defined in YAML files within a module's `config/modify` directory and are applied when Drupal installs optional configuration.
This module allows other modules to define changes to installable configuration
in a config/modify folder.
Usage
This module will try to apply modifications whenever Drupal core would install optional config.
Modification Format
Modifications are defined in YAML files in the config/modify folder of your
module. Files must be named <module>.<unique>.yml where <module> matches the
name of your module and <unique> is a unique string (e.g. add_search_field).
The files contain two top-level keys: dependencies and items. The contents
of dependencies matches Drupal core's config dependency format. items should
contain a list of named config items using the Config Update Definition format
from the update_helper module.
All configuration keys under items are implicit config dependencies, providing
for atomic updates.
For example to add an article field to a search index:
dependencies:
config:
- field.field.node.article.body
items:
search_api.index.my_search:
expected_config: { }
add:
field_settings:
article_body:
label: Article Contents
datasource_id: 'entity:node'
property_path: body
type: text
dependencies:
config: field.field.node.article.body
The above file will automatically add an article_body field to the my_search
index when the search index exists and the body field exists on the article
node type. If the search index or the field does not exist it will do nothing.
Limitations
We currently must overwrite the ConfigInstall class because it doesn't provide a proper hook to run after optional config is updated.
Similarly we must overwrite the update_helper's Updater class because it doesn't allow executing a CUD without loading it from config/update.
If we can solve those two issues then we can simplify our code quite a bit.
Ask your assistant about Config Modify
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- Update helper
- config Drupal core
Required by
2 tracked projects depend on this one
- Social Geolocation 23 sites
- Social Course 6 sites
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.2.0 | Stable | 9–11 | Sep 30, 2024 | ||
| 1.1.2 | Stable | 9–10 | Sep 30, 2024 | ||
| 1.1.1 | Stable | 9–10 | PHP ^8.1 | Jul 17, 2024 | |
| 1.1.0 | Stable | 9–10 | PHP ^8.1 | Dec 22, 2023 | |
| 1.x-dev | Dev | 9–11 | PHP ^8.1 | Dec 22, 2023 | |
| 1.0.0 | Stable | 9–10 | PHP ^8.1 | Dec 20, 2023 | |
| 1.0.x-dev | Dev | 9–10 | PHP ^8.1 | Apr 13, 2023 | |
| 1.0.0-rc1 | Pre-release | 9–10 | Apr 13, 2023 |