Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Config Importer and Tools

412 sites Security covered Drupal 11 · not 10
View on drupal.org

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)

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
10
Tracked since
Feb 2025
Latest release
3 weeks ago
Releases (12 mo)
2 ▼ from 8
Maintenance
Active

Release Timeline

Releases

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