Move DisplayBuildableInterface to a Provider plugin type

Created on 29 September 2025, 25 days ago

Problem/Motivation

Step by step, DisplayBuildableInterface is becoming big and messy:

  public static function getPrefix(): string;
  public static function getContextRequirement(): string;
  public static function checkInstanceId(string $instance_id): ?array;
  public function getBuilderUrl(): Url;
  public static function getUrlFromInstanceId(string $instance_id): Url;
  public static function getDisplayUrlFromInstanceId(string $instance_id): Url;
  public function getProfile(): ?ProfileInterface;
  public function getInstanceId(): ?string;
  public function initInstanceIfMissing(): void;
  public function getInitialSources(): array;
  public function getInitialContext(): array;
  public function getSources(): array;
  public function saveSources(): void;

And not discoverable, so we have added display_builder_provider_info hook.

Proposed resolution

Create a display_builder/Provider plugin type

With attribute discovery. Not configurable.

ProviderInterface:

  • getProfile(): ProfileInterface (the one saved in config/content, not the one from Instance)
  • getInstance(): InstanceInterface
  • getInitialSources(): array;
  • getContextRequirement(): string;
  • getContext(): array; (renamed from getInitialContext())
  • getSources(): array;
  • saveSources(): void;
  • getUrl(): Url (as a replacement of both getBuilderUrl() and getDisplayUrlFromInstanceId)
  • getDisplayUrl(): Url (as a replacement of getDisplayUrlFromInstanceId)

We may not need this anymore:

  • all static functions taking instance_id as parameter: checkInstanceId, getUrlFromInstanceId, getDisplayUrlFromInstanceId because we now work on instanciated plugins
  • getPrefix(): not currently used outside the classes. Can be replaced by a plugin attribute.
  • getInstanceId(): replaced by getInstance()->id() or something like that
  • getInitialSources() : only used in InstanceStorage::createFromImplementation()
  • initInstanceIfMissing(): because implementation always the same, can be moved to a base class

Move DisplayBuildableInterface implementation logic to 4 plugins

  • modules/display_builder_entity_view/src/Plugin/display_builder/Provider/EntityView.php
  • modules/display_builder_entity_view/src/Plugin/display_builder/Provider/ContentOverride.php
  • modules/display_builder_page_layout/src/Plugin/display_builder/Provider/PageLayout.php
  • modules/display_builder_views/src/Plugin/display_builder/Provider/ViewDisplay.php

Replace display_builder_provider_info by the plugin type manager

that's it

πŸ“Œ 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

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