Automatically created fields cause error during clone

Created on 19 March 2025, about 1 month ago

Problem/Motivation

Certain modules (like Domain for instance) automatically add fields upon content type creation, leading to an error when this module wants to add it again.

The website encountered an unexpected error. Try again later.Drupal\Core\Entity\EntityStorageException: 'field_config' entity with ID 'node.[node-type].field_domain_access' already exists. in Drupal\Core\Entity\EntityStorageBase->doPreSave() (line 519 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

Steps to reproduce

Install this module next to the domain module (including the domain_access submodule).

Proposed resolution

Add an extra check during cloning to see if a field already exist.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇪Belgium ulaire

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

Comments & Activities

Production build 0.71.5 2024