Allow site builders to filter content reference selections by view mode as well as by content type

Created on 4 October 2021, almost 3 years ago
Updated 30 January 2023, over 1 year ago

Problem/Motivation

Site builders often want to create curated lists of teasers of arbitrary pages. It can be tedious to manually "opt-in" new content types as reference-able. Instead, I would like to allow any content type with a particular view mode to be referenced since I can be reasonably confident that if a content type has that view mode, it will be rendered correctly.

Proposed resolution

Add this configuration option to the core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php file.

User interface changes

A new configuration options for node reference fields is available.

API changes

None.

Data model changes

None.

Release notes snippet

Entity reference fields referencing nodes can now be configured to allow content authors to reference content with a particular view mode. Previously, these fields could only be configured to reference specific content types.

Feature request
Status

Needs work

Version

10.1

Component
Node system 

Last updated 1 minute ago

No maintainer
Created by

🇫🇷France gabesullice 🇫🇷 ①③ UTC+2

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Production build 0.71.5 2024