It seems that entity_type_behaviors_entity_bundle_field_info (hook_entity_bundle_field_info) get's called twice in some cases.
I've noticed it when editing the languages page. admin/config/regional/content-language
In this hook the override is created (BaseFieldOverride::createFromBaseFieldDefinition()). When saving the Language page this get's called twice, and tries twice to create the override which fails.
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Entity\EntityStorageException</em>: 'base_field_override' entity with ID 'paragraph.call_to_action.behaviors' already exists. in <em class="placeholder">Drupal\Core\Entity\EntityStorageBase->doPreSave()</em> (line <em class="placeholder">482</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/EntityStorageBase.php</em>). <pre class="backtrace">Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 263)
This means we should check if the override already exists to see if we need to create it. Following core this adds a check before calling the $field = BaseFieldOverride::createFromBaseFieldDefinition() function. See Usage in https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Field%21B...
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3072832-3.patch | 826 bytes | mallezie |
| #2 | 3072832-1.patch | 910 bytes | mallezie |
Comments
Comment #2
malleziePatch attached.
Comment #3
mallezieAnd for silly issues like that i've enabled the automated testing ;-)
Comment #5
mallezieReviewed with mheip and committed.
Comment #7
mallezie