Handle block contexts

Created on 4 November 2024, about 1 month ago

Overview

Following 📌 Add support for Blocks as Components Active we only handle blocks that do not have required contexts.

At some point we will need block contexts in order to place blocks that are dependent on e.g. the current node.

Proposed resolution

?

User interface changes

📌 Task
Status

Active

Version

0.0

Component

Page builder

Created by

🇬🇧United Kingdom longwave UK

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

Comments & Activities

  • Issue created by @longwave
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    How will that be conveyed in the UI? How will the user be informed that more/different choices become available depending on the context they're editing a component tree for?

    @lauriii: Is this in scope for 🌱 Milestone 0.2.0: Experience Builder-rendered nodes Active ?

  • 🇫🇮Finland lauriii Finland

    Would it be possible to provide a list of blocks that this impacts and what are the contexts they depend on? This would help me understand the impact of this and would make this more actionable for design.

    Is there some existing UX for this in the Block module or Layout Builder?

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Would it be possible to provide a list of blocks that this impacts and what are the contexts they depend on? This would help me understand the impact of this and would make this more actionable for design.

    Grep for context_definitions: [ ("block" attribute), context_definitions = { ("block" annotation) or context_definitions'] (in block plugin derivers).

    That surfaces the following (derived) block plugins in core:

    • \Drupal\layout_builder\Plugin\Derivative\FieldBlockDeriver
    • \Drupal\layout_builder\Plugin\Derivative\ExtraFieldBlockDeriver
    • \Drupal\views\Plugin\Derivative\ViewsBlock

    Is there some existing UX for this in the Block module or Layout Builder?

    AFAICT there is not. It's "magic"; it's precisely the much more narrow constraints of the Layout Builder UX that mean that there wasn't a need for a generic UX for this in core. Views similarly provided a narrower UX when configuring Views blocks (and the Block UI then didn't visualize it, nor provided affordances).

    It's precisely the lack of properly informing the end user that makes the Block UI so bad, and which XB should do better.

    P.S.: I'm totally fine with saying: XB does not support any block plugins that have optional or required contexts defined. But we'll need to figure this out before we can migrate/upgrade Layout Builder to XB.

  • 🇫🇮Finland lauriii Finland

    This is not in scope for 0.2.0. Potentially not in scope for 1.0.0 but need to evaluate later.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Thanks for clarifying, @lauriii!

    📌 Define `props` in the context of Block components Active is working on supporting Block-sourced Component's explicit inputs: settings (equivalent to SDC-sourced Component's explicit inputs: props).

    This issue is about supporting Block-sourced Component's implicit inputs: contexts. There is no equivalent of this for SDC-sourced Components, but there may be for other component types. See 🌱 [META] Support component types other than SDC Needs work .

Production build 0.71.5 2024