Is this intended to be used for updating existing config?

Created on 12 January 2018, over 7 years ago
Updated 6 June 2025, about 1 month ago

It's not clear to me if this module can be used to update existing configuration objects, rather than installing new config objects for a module that's already been installed.

For example,

$config_importer = \Drupal::service('config_import.importer');
$dir = drupal_get_path('module', 'my_module') . '/config/install';
$config_importer->setDirectory($dir);
$config_importer->import(['core.entity_view_mode.media.testing']);

Does this work if the config object core.entity_view_mode.media.testing already exists and you just want to update it? I'm confused how that would work because you'd be overwriting the existing config object with one that doesn't have a config hash. Drupal uses that config hash to determine if a config object is being updated or if it's new.

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    This is still an open question that would be great to answer on the project page also. Thanks!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Sadly seems like it isn't. This was also my hope, as I just needed to import some new config files from config/install in a module. My expectation was that only these were imported and updated, but instead a lot of existing configuration was deleted.

Production build 0.71.5 2024