Remove the tight coupling between Block Plugins and Block Entities

Created on 26 February 2013, over 11 years ago
Updated 6 March 2024, 9 months ago

Problem Description:

Block plugins have a hard dependency on block entities, making it impossible to reuse the block plugin system for blocks whose configurations are not stored in independent entities (for example, for ones stored inline into Panels layouts). We need to fix that so that block plugins only depend on a passed in configuration array: whether that configuration is stored in an independent entity or not should not be a concern for block plugin implementations, hook_block_view_alter(), or theme('block').

Patch summary:

- Within the block CMI files, puts plugin-relevant configuration into a 'settings' key.
- Makes $block_entity->view() a very thin wrapper to $block_plugin->build(). Makes hook_block_view_alter() and theme('block') act only on the plugin, and not receive any entity information (except for a follow up needed for #1989568: Remove block config ID from being used as an HTML ID or template suggestion ).
- Moves visibility conditions (e.g., pages, roles) into the entity-level access controller.
- Reorganizes the entity's form controller and plugin's form methods to each be responsible for their respective settings.

Followup Issues:

Original Report:

In the process of moving block configuration to be configuration entities, I feel we ended up tightly coupling too much of the block system with a supporting entity structure, and we should fix that before we get too much further into feature freeze. This is a first patch that is designed to point the way. Ultimately Block Entities will end up as typed data and we'll not abuse the export properties method to get our data, but for the time being this works very nicely. I'm sure many many tests will fail or fatal on this.

Eclipse

ToDO

update original blocks as plugins change notice... https://drupal.org/node/1880620
#1871696: Convert block instances to configuration entities to resolve architectural issues change notice (not sure if this is a todo for this issue)

📌 Task
Status

Fixed

Version

8.0 ⚰️

Component
Block 

Last updated 1 day ago

Created by

🇺🇸United States EclipseGc

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

Sign in to follow issues

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