Implement WithDisplayBuilderInterface in Entity View

Created on 25 July 2025, 4 days ago

The follow-up of 📌 Align config storage properties & mechanisms Active

📌 Task
Status

Active

Version

1.0

Component

display_builder_entity_view

Created by

🇫🇷France pdureau Paris

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

Merge Requests

Comments & Activities

  • Issue created by @pdureau
  • 🇫🇷France pdureau Paris

    Remain work:

    • Regression, display not rendered. Looks like a context issue.
    • Remove DisplayBuilder::DISPLAY_BUILDER_CONFIG again
    • Update devel controller again
  • 🇫🇷France pdureau Paris

    Tested with Mikael, works OK.

    However, we need to apply this drafty patch to make it works:

    diff --git a/modules/display_builder_entity_view/src/Entity/DisplayBuilderEntityViewDisplay.php b/modules/display_builder_entity_view/src/Entity/DisplayBuilderEntityViewDisplay.php
    index bb35966..4d731fb 100644
    --- a/modules/display_builder_entity_view/src/Entity/DisplayBuilderEntityViewDisplay.php
    +++ b/modules/display_builder_entity_view/src/Entity/DisplayBuilderEntityViewDisplay.php
    @@ -238,7 +238,7 @@ class DisplayBuilderEntityViewDisplay extends LayoutBuilderEntityViewDisplay imp
         $this->stateManager->create($instance_id, (string) $this->getDisplayBuilder()->id(), [], $contexts);
         // Careful. StateManager::create() is not saving properly the contexts.
         // Let's do it again.
    -    $this->stateManager->setContexts($instance_id, $contexts);
    +    //$this->stateManager->setContexts($instance_id, $contexts);
       }
     
       /**
    diff --git a/src/IslandPluginBase.php b/src/IslandPluginBase.php
    index dd69177..f76e068 100644
    --- a/src/IslandPluginBase.php
    +++ b/src/IslandPluginBase.php
    @@ -47,7 +47,7 @@ abstract class IslandPluginBase extends PluginBase implements IslandInterface {
       /**
        * The contexts for islands.
        */
    -  protected array $contexts = [];
    +  //protected array $contexts = [];
     
       /**
        * {@inheritdoc}
    @@ -64,8 +64,8 @@ abstract class IslandPluginBase extends PluginBase implements IslandInterface {
       ) {
         parent::__construct($configuration, $plugin_id, $plugin_definition);
         $this->data = $configuration;
    -    $this->contexts = $configuration['contexts'] ?? [];
    -    unset($configuration['contexts']);
    +   // $this->contexts = $configuration['contexts'] ?? [];
    +   // unset($configuration['contexts']);
         $this->setConfiguration($configuration);
       }
     

    It is related to 📌 Add the island configuration forms Active

  • 🇫🇷France pdureau Paris

    I take it back, i need to add little rule in ::initInstanceIfMissing()

  • 🇫🇷France pdureau Paris

    Everything done.

    Follow-up: 📌 WithDisplayBuilderInterface follow-ups Active

Production build 0.71.5 2024