Problem/Motivation

      // For the 'target_bundles' setting, a NULL value is equivalent to "allow
      // entities from any bundle to be referenced" and an empty array value is
      // equivalent to "no entities from any bundle can be referenced".

and

    // If 'target_bundles' is NULL, all bundles are referenceable, no further
    // conditions are needed.

and

      // If 'target_bundles' is an empty array, no bundle is referenceable,
      // force the query to never return anything and bail out early.

This seems weird but there is a reason -- @berdir on Slack writes:

> the null vs empty array situation is due to config dependencies and updates. if you allow a single target bundle, then remove that bundle, the field would now allow any bundle if you weren't making a difference between null and empty array.

This should be documented in the code -- probably added to the comment in defaultConfiguration()

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3453786

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joachim created an issue. See original summary.

Soham Sengupta made their first commit to this issue’s fork.

soham sengupta’s picture

Status: Active » Needs review

Hi, I have added the changes and created the MR. Moving the issue status to Needs Review.
Thank you.

smustgrave’s picture

Version: 11.0.x-dev » 11.x-dev
Status: Needs review » Needs work

Haven't reviewed but MR should be against 11.x

rodrigoaguilera’s picture

Issue tags: +Barcelona2024
Novice issue reserved for the Mentored Contribution during DrupalCon Barcelona 2024. After the 27th of September 2024, this issue returns to being open to all. Thanks

Fix the base branch of the MR

drupatz’s picture

working on this one at Barcelone2024

drupatz’s picture

Status: Needs work » Needs review
joachim’s picture

Status: Needs review » Needs work

Looks like this needs work as there's a merge error.

Text is great apart from one small thing:

> // is to correctly handle the config updates.

Shouldn't be a 'the' here.

drupatz’s picture

Status: Needs work » Needs review

Removed the "the" --- couldn't find any merge issue, maybe tested the wrong pr? Should be 9630

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Ah right!

There's a 2nd MR shown at the top of the issue, on the same line, which confused me.

In which case, RTBC!

quietone’s picture

Title: DefaultSelection should document why values for target_bundles NULL and [] behave as they do » In DefaultSelection document why values for target_bundles NULL and [] behave as they do
Issue tags: -Novice

  • quietone committed e1a109a2 on 11.x
    Issue #3453786 by soham sengupta, drupatz, joachim, smustgrave,...
quietone’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Novice

Thanks to everyone for improving our documentation!

Didn't mean to remove the Novice tag. The first sentence of this MR was not wrapped correctly, fixed on commit.

Committed e1a109a and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.