Implements ObjectWithPluginCollectionInterface

Created on 6 August 2025, 7 days ago

Problem/Motivation

We are defining some classes with properties being plugins attachments/collections:

  • display_builder/DisplayBuilder config entity type (which may be renamed "Profile"):
    • Islands plugins in island property
  • display_builder/PatternPreset config entity type:
    • UI Patterns Sources plugins in sources property
  • display_builder_page_layout/PageLayout config entity type:
    • UI Patterns Sources plugins in sources property
    • Conditions plugins in conditions property (this one is already managed by ConditionPluginCollection, so PageLayout already implement EntityWithPluginCollectionInterface)
  • display_builder_views/DisplayBuilderDisplayExtender ViewsDisplayExtender plugin :
    • UI Patterns Sources plugins in sources property

There is a Drupal mechanism to attach collections of plugins in a config entity in a standardized way:

This may brings the following benefits:

  • make the plugin attachments obvious among other properties
  • move the specific logic to a distinct, reusable, class
  • the lazy loading may improve performance
  • ConfigEntityBase is doing some nice stuff like calculating automatically the dependencies
  • ConfigEntityBase and EntityForm are managing some aspects of the values saving

Proposed resolution

Create an IslandPluginCollection:

  • use it in DisplayBuilder config entity
  • add DisplayBuilderInterface::getIslands() method
  • move part of this logic scope to IslandPluginCollection: getIslandEnabled(), getIslandConfigurations(), getIslandConfiguration(), setIslandConfiguration()?

Create an SourcePluginCollection:

  • use it in PatternPreset and PageLayout config entities and maybe in DisplayBuilderDisplayExtender plugin. It may also useful for display_builder_entity_view/EntityViewDisplay even if we work with third party settings here.
  • is it also the opportunity of centralizing some logic here?
📌 Task
Status

Active

Version

1.0

Component

Main / Misc.

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024