DefaultSelection for configuration entities should not return disabled entities by default

Created on 18 June 2023, over 1 year ago
Updated 1 September 2023, about 1 year ago

Problem/Motivation

When using the entity reference selection with a configuration entity type, i.e. Views, it will return disabled configuration entities.

Steps to reproduce

  • Disable a View on the site
  • Create a new Entity Reference field on a content type, set it to reference Views
  • Try to create content and see in the field options, your disabled view is visible

Proposed resolution

Because there is no entity query alter for configuration entities, I propose that the DefaultHandler should check if the desired type is a configuration entity type, and if so, add a condition to not return disabled plugins by default. There could be an opt-in setting like $selection_handler_options['config_include_disabled'] = TRUE to include them if needed.

Remaining tasks

User interface changes

  • Disabled entities would no longer be visible by default with entity reference fields.
  • Adds a new checkbox to opt-in to including disabled entities in the field settings.

API changes

Data model changes

None

Release notes snippet

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
EntityΒ  β†’

Last updated about 13 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024