DefaultSelection should document why values for target_bundles NULL and [] behave as they do

Created on 10 June 2024, 3 months ago
Updated 15 July 2024, about 2 months ago

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

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Documentationย  โ†’

Last updated less than a minute ago

No maintainer
Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024