Problem/Motivation

During implementation of a custom entity I debugged the entity reference field autocomplete functionality, as it was not working.
When referencing a new custom entity, the error
There are no entities matching "Entity label"
pops up.

Proposed resolution

Beside the right configuration (where different are possible). The code for selecting the bundle is not triggered at all.

Remaining tasks

There are a lot of tasks open about entity creation. Fe. a user reference field does not work.
The entity reference fields should store they're bundles in auto_create_bundle for "bundle-less" or in target_bundles for ones having multiple bundles.
This issue is thought as quick fix. The remaining task shall be done in subsequent (existing) issues, fe.
#2700411: "Create referenced entities if they don't already exist" option on entity reference field shouldn't be available for users

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

ytsurk created an issue. See original summary.

ytsurk’s picture

cilefen’s picture

Status: Active » Needs work
ytsurk’s picture

Status: Needs work » Needs review
StatusFileSize
new1.29 KB
ytsurk’s picture

Component: entity system » field system
Issue tags: +Entity Reference

Status: Needs review » Needs work

The last submitted patch, 4: 3083056-check_auto_create_bundle_always-4.patch, failed testing. View results

ytsurk’s picture

Status: Needs work » Needs review
ytsurk’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 4: 3083056-check_auto_create_bundle_always-4.patch, failed testing. View results

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.9 was released on November 6 and is the final full bugfix release for the Drupal 8.7.x series. Drupal 8.7.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.8.0 on December 4, 2019. (Drupal 8.8.0-beta1 is available for testing.)

Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

heilop’s picture

I reloaded the patch.
I'm not sure if the if ($this->getSelectionHandlerSetting('auto_create')) { if closed before. I've changed that.

heilop’s picture

Status: Needs work » Needs review
ytsurk’s picture

Works good and is cleaner. Thanks!

ytsurk’s picture

heilop’s picture

Sounds great!

@ytsurk, Can we mark as RTBC?

ytsurk’s picture

I'm not sure, as stated in the issue description, this is more a quick fix and the root cause needs broader (conceptual) work, so I would suggest to maintain here a patch for the ones that know what they're doing ...

heilop’s picture

Gotcha, thanks!

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

ytsurk’s picture