Compatibility with UI patterns 2

Created on 22 January 2025, 1 day ago

Problem/Motivation

following up an issue from ui patterns 📌 [2.0.0-rc2] ContextException with entity:paragraph Active ,
we need to carefully ensure that DS entity view will inject the rendered entity inside the context, or we need to add a specific mechanism to allow a custom resolver to resolve the entity for ui patterns2.

📌 Task
Status

Active

Component

Code

Created by

🇫🇷France just_like_good_vibes PARIS

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

Comments & Activities

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

    we found the solution.

    one needs to implement

    
    function ui_patterns_ds_preprocess_ds_entity_view(&$variables) {
       if (isset($variables['content']) && isset($variables['content']['#entity']) && isset($variables['content']['#source_contexts'])
          && is_array($variables['content']['#source_contexts']) && !isset($variables['content']['#source_contexts']["entity"])) {
        $variables['content']['#source_contexts']["entity"] = \Drupal\Core\Plugin\Context\EntityContext::fromEntity($variables['content']['#entity']);
      }
    }
    
Production build 0.71.5 2024