Problem/Motivation

When there are configurations inside a collection, the module does not import them correctly.

Steps to reproduce

1. Create a module with a configuration collection structure:

my_module/
  config/
    config1.yml
    language/
      es/
        config1.yml

2. Add an update hook to import configuration:

function my_module_update_11101() {
  \Drupal::service('devutils.update_import')
    ->import('my_module', [
      'config1',
    ]);
}

3. Run the update.

Expected:
Both config1.yml and language/es/config1.yml should be imported.

Actual:
Only config1.yml is imported; the language.es collection is ignored.

Comments

reyrpb created an issue.

jleon1110’s picture

The problem is that in the hook used, only one file, config1.yml, is being imported.

<?php
function my_module_update_11101() {
  \Drupal::service('devutils.update_import')
    ->import('my_module', [
      'config1',
      'language.es.config1',
    ]);
}
?>

I haven't tested it yet, but according to the documentation, this configuration should allow importing both files exclusively.

ruby232’s picture

I think it's better to automatically add the language collection and only import it if the corresponding configuration files exist.