Add support for placing and configuring blocks

Created on 9 May 2024, 6 months ago
Updated 12 June 2024, 5 months ago

Problem/Motivation

I'd like to use ECA to place and configure blocks that are defined in code (i.e. not custom blocks), and configure their configuration values. For example, we have a block that takes, as a parameter, the path to a JSON manifest provided by a view. It renders the data based on the manifest to be the content of the block.

Steps to reproduce

While we can place views that have block displays, there is no ability right now to add a block.

Feature request
Status

Active

Version

2.1

Component

User interface

Created by

🇨🇦Canada rosiel

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

Comments & Activities

  • Issue created by @rosiel
  • 🇨🇦Canada rosiel

    I have managed such mischief using Twig Tweak. With that module enabled, I can use the ECA "Render: Twig" Action, and following Twig Tweak's Rendering Blocks instructions I can enter something like:
    {{ drupal_block('my_block_plugin_id', { some_setting: 'Text including tokens like [node:title]!', }) }}

    In twig tweak 3.3.0, it appears the setting of the block's label in {{ drupal_block }} is broken, so that's sadly not an option.

    For my use case, it would be nicer to have the Block configuration form right in ECA, the way (non-preconfigured) Actions can be selected, and have their configuration form display. It would also be nice to have the functionality of rendering a block without relying on an external module. While I'm aiming high, it would be nice as a site builder to see Contextual Links, and for one of those links to be to "Edit block in ECA" since it can often be opaque why a block is showing up where it is.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Rendering blocks directly from within ECA would mean that we have to provide a separate action plugin for each available block on the current Drupal site. That's the only way to get individual configuration forms for each block. So, the list of plugins would grow by the number of blocks that's visible in the block layout when "Place block" is being clicked in a region. That might be ok, I guess?

    The visibility settings won't be supported, though, since ECA can already manage that upfront.

    While I'm aiming high, it would be nice as a site builder to see Contextual Links, and for one of those links to be to "Edit block in ECA" since it can often be opaque why a block is showing up where it is.

    That's out-of-reach, I'm afraid.

  • 🇩🇪Germany jurgenhaas Gottmadingen
Production build 0.71.5 2024