Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292761

Config translation import sometimes fails when default config translation override is updated

$
0
0

Problem/Motivation

Config translation import sometimes fails when the default config translation and the config translation override are updated simultaneously. The error generated is: Update target "core.entity_form_display.node.article.default" is missing.

Steps to reproduce

1) Execute drush site:install -y
2) Executedrush en config_translation -y
3) Executedrush ev "\Drupal\language\Entity\ConfigurableLanguage::createFromLangcode('nl')->save()"
4) Executedrush cex -y
5) Add a config translation file for the default form display of content type Article
Execute

mkdir -p config/sync/language/nl
vi config/sync/language/nl/core.entity_form_display.node.article.default.yml

and add the following content to the file

content:
  field_tags:
    weight: 99

6) Executedrush cim -y
7) Manually hide the field_tags field in the form display:
vi config/sync/core.entity_form_display.node.article.default.yml
Remove

  field_tags:
    type: entity_reference_autocomplete_tags
    weight: 3
    region: content
    settings:
      match_operator: CONTAINS
      match_limit: 10
      size: 60
      placeholder: ''
    third_party_settings: {  }

and replace

hidden: {  }

with

hidden:
  field_tags: true

8) Manually alter the config translation for the form display
Execute
vi config/sync/language/nl/core.entity_form_display.node.article.default.yml
Replace

content:
  field_tags:
    weight: 99

with

content:
  body:
    weight: 99

9) Executedrush cim -y

What I expect: the config to be imported successfully.
What actually happens:

+-------------+-----------------------------------------------+-----------+
| Collection  | Config                                        | Operation |
+-------------+-----------------------------------------------+-----------+
|             | core.entity_form_display.node.article.default | Update    |
| language.nl | core.entity_form_display.node.article.default | Update    |
+-------------+-----------------------------------------------+-----------+

 // Import the listed configuration changes?: yes.                                                                      

 [notice] Synchronized configuration: update core.entity_form_display.node.article.default.
 [notice] Synchronized configuration: update core.entity_form_display.node.article.default in language.nl.
 [notice] Finalizing configuration synchronization.
 [error]  Drupal\Core\Config\ConfigException: Errors occurred during import in Drush\Commands\config\ConfigImportCommands->doImport() (line 276 of /app/vendor/drush/drush/src/Commands/config/ConfigImportCommands.php). 

In ConfigImportCommands.php line 290:
                                                                             
  The import failed due to the following reasons:                            
  Update target "core.entity_form_display.node.article.default" is missing.  
                                                                             

In ConfigImportCommands.php line 276:
                                 
  Errors occurred during import  

Proposed resolution

I don't have a solution to the problem, but I did find the cause:
In my example above, core.entity_form_display.node.article.default (the non-translation override) is imported first.
The override translation file is then deleted in \Drupal\Core\Config\ConfigFactoryOverrideBase::filterOverride(), because at that point in time the override translation file is empty.
The changes we made to the override translation file are only imported after the non-override translation file is imported, so it's to late - hence the issue.


Viewing all articles
Browse latest Browse all 292761

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>