Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module helps manage configuration imports during Drupal development. It allows you to import or export only specific configuration files or features through update hooks, preventing accidental overwrites or deletions. It also provides Drush commands for easier management and integration with the Features module.

πŸ‡ΊπŸ‡¦

This module is maintained by Ukrainian developers.
Please consider supporting Ukraine in a fight for their freedom and safety of Europe.

This module aims to cover development needs with managing configurations during project development.

Importing all configs during development is not convenient and can lead to a bad behaviour with overwriting or deleting configs or content from a site.

So there is a need for importing only of specific configs via hook_update_N().

Usage

All the work happening with the config_import.importer service. Let's instantiate it:

/* @var \Drupal\config_import\ConfigImporterServiceInterface $config_importer */
$config_importer = \Drupal::service('config_import.importer');

By default, import and export operations will use the sync directory. But, if needed, it could be changed to a path of existing directory or type of already configured configuration directories. For instance:

// $config_importer->setDirectory(CONFIG_STAGING_DIRECTORY);
$config_importer->setDirectory('/var/config');

You may do so to import existing configs:

$config_importer->importConfigs(['core.extension']);

And export can be achieved with a similar construction:

$config_importer->exportConfigs(['core.extension']);

Features integration

To revert/import features you have to enable the features module first:

drush en features -y

Get instance of service:

/* @var \Drupal\config_import\ConfigFeaturesImporterServiceInterface $features_importer */
$features_importer = \Drupal::service('config_import.features_importer');

And do the import:

$features_importer->importFeatures(['feature1', 'feature2']);

Drush integration

Execute the next command to see the list of available commands from a group:

drush help --filter=config_import

Then use the following syntax to find out more information about concrete command:

drush help COMMAND_NAME

Example use cases

/**
 * Revert custom block feature.
 */
function ygh_master_update_8024() {
  \Drupal::service('config_import.features_importer')->importFeatures(['openy_block_custom_simple']);
}

/**
 * Update HTML format config.
 */
function ygh_master_update_8025() {
  /* @var \Drupal\config_import\ConfigImporterServiceInterface $config_importer */
  $config_importer = \Drupal::service('config_import.importer');
  $config_importer->setDirectory(YGH_CONFDIR);
  $config_importer->importConfigs(['filter.format.html']);
}

To do

  • Create UI for making manual config changes convenient

Video about this module: https://www.youtube.com/watch?v=vFsgNjhGr4Y
Recent video from @froboy - https://www.youtube.com/watch?v=SvSDes_6Tmo

For updating specific property in config:

1) go to related to this config module

2) create new hook_update_N in openy_*.install file

3) in update add next code (this is example):

$config = drupal_get_path('module', 'openy_media_image') . '/config/install/views.view.images_library.yml';
$config_importer = \Drupal::service('config_import.param_updater');
$config_importer->update($config, 'views.view.images_library', 'display.default.display_options.pager');

Where:

  • $config variable contains path to config with config name
  • "views.view.images_library" - config name
  • "display.default.display_options.pager" - config specific property (you can set value from a nested array with variable depth)

Activity

Total releases
9
First release
Feb 2025
Latest release
8 months ago
Releases (12 mo)
1 ▼ from 8
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
4.1.1 Stable Nov 12, 2025
4.0.1 Stable Jul 11, 2025
4.0.0-alpha1 Pre-release Jul 11, 2025
4.x-dev Dev Jul 11, 2025
4.0.0 Stable Jul 1, 2025
3.2.3 Stable Jul 1, 2025
3.2.2 Stable Jun 30, 2025
3.2.1 Stable May 1, 2025
3.2.0 Stable Feb 18, 2025