Enable autocreate bundle when 2+ bundles may be referenced

Created on 2 March 2022, over 2 years ago
Updated 4 September 2024, 24 days ago

Problem/Motivation

DER field storage and config edit forms allow user to:

  • select an entity type to be referenced
  • select 2+ bundles of an entity type
  • select one of the bundles as the autocreate bundle
  • but on submit of config form yields an exception

Steps to reproduce

  • install two modules (A,B) providing an entity type with bundles
  • add two+ bundles to entity type A
  • add der field to a bundle of entity type B
  • configure its storage settings to include entity type A
  • edit field settings
  • in reference type for A
  • check 2+ of A bundles
  • check 'Create referenced entities if they do not already exist'
  • select one of the A bundles for autocreate
  • click 'Save settings'
InvalidArgumentException: Missing required #autocreate['bundle'] parameter
in Drupal\Core\Entity\Element\EntityAutocomplete::processEntityAutocomplete()

Proposed resolution

See patch.

Remaining tasks

None. (tests included in patch)

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States solotandem

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.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.2 & MySQL 8 (--ignore-platfrom-reqs)
    last update 8 months ago
    Composer require failure
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 8 months ago
    Build Successful
  • πŸ‡©πŸ‡ͺGermany stevieb

    The Patch in #2 patch no longer works and the error persists without it using 3.x-dev

  • Status changed to Needs work 24 days ago
  • Patch is not working. Same problem exists in version-4.

    InvalidArgumentException: Missing required #autocreate['bundle'] parameter. in Drupal\Core\Entity\Element\EntityAutocomplete::processEntityAutocomplete() (line 167 of /var/www/html/d10site/web/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php).
    

    Also, if the DER field includes a comment type, you cannot save the field settings.

Production build 0.71.5 2024