Add an EntityReferenceSelection plugin for block references

Created on 14 May 2021, over 3 years ago
Updated 13 December 2023, about 1 year ago

Problem/Motivation

When one is using a block entity reference field, it would be convenient if the list of referenceable blocks could be limited a subset relevant to a particular field instance. For example, when one creates a node entity reference field, it is possible to limit the selectable entities by bundle. Here is an example of the handler settings form for a node reference:

Currently, there is no similar mechanism for limiting referenceable blocks.

However, Drupal core already has a way of grouping blocks―by category:

Proposed resolution

Add an EntityReferenceSelection plugin which creates add checkboxes (one for each block category) to limit the selectable blocks. For example, one could limit a field to the "Lists (Views)" category so that only Views blocks could be selected.

Remaining tasks

In a followup issue, it may make sense to allow custom block types to define the category to which they belong.

User interface changes

A new set of options will be available on the field instance settings form of block entity reference fields.

Before:

After:

API changes

None.

Data model changes

None.

Release notes snippet

Block entity reference field selection can now be limited by block category.

✨ Feature request
Status

Needs work

Version

11.0 🔥

Component
Block  →

Last updated 1 day ago

Created by

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

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024