|
6 years ago | |
---|---|---|
.. | ||
src | 6 years ago | |
tests | 6 years ago | |
.gitignore | 6 years ago | |
.travis.yml | 6 years ago | |
LICENSE.txt | 6 years ago | |
README.md | 6 years ago | |
composer.json | 6 years ago | |
config_filter.info.yml | 6 years ago | |
config_filter.services.yml | 6 years ago |
Modules such as Config Split want to modify the configuration when it is synchronized between the database and the exported yaml files. This module provides the API to do so but does not influence a sites operation.
Configuration Filter swaps the config.storage.sync service from Drupal 8 core. The new service wraps the file storage and applies filters to it. This allows other modules to change the configuration as it gets imported or exported both in the Drupal UI and with drush.
A ConfigFilter is a plugin. This module provides the plugin definition, the plugin manager and the storage factory. A ConfigFilter can have the following annotation:
/**
* @ConfigFilter(
* id = "may_plugin_id",
* label = @Translation("An example configuration filter"),
* weight = 0,
* status = TRUE,
* storages = {"config.storage.sync"},
* )
*/
See \Drupal\config_filter\Annotation\ConfigFilter
.
The weight allows the filters to be sorted. The status allows the filter to be
active or inactive, the ConfigFilterManagerInterface::getFiltersForStorages
will only take active filters into consideration. The weight, status and
storages are optional and the above values are the default.
Plugins are only available from enabled modules. If you want to provide a
config filter from a php library, all you have to do is implement the
\Drupal\config_filter\ConfigFilterManagerInterface
and add it to the
service container with a config.filter
tag.
Services with higher priority will have their filters added first.