I recently had a use case where I needed context to assign weight of the "Main content" block between some other blocks. As it currently stands block attributes assigned by core will always take precedence. As a proof of concept, i created a patch that allows blocks to be overriden by context.
The patch creates a form checkbox attribute in the block edit screen that allows conditional overriding (see attached screenshot). When context renders blocks in the context_reaction_block->execute() it checks to see if the block has been overridden. If so, it unsets it from the $page[$region] array, allowing the block defined in $this->block_get_blocks_by_region($region) to take priority.
This patch is ONLY a proof of concept to determine feasibility. While it is fully functional, it isn't meant for production or to be committed. I would make some major refactoring prior to creating an "official" patch. I think there is a valid use case for the functionality it provides but wanted to run it by the community before investing further resources.
| Comment | File | Size | Author |
|---|---|---|---|
| context_block_override.patch | 5.2 KB | ngmaloney | |
| _Main page content_ block | Pain Research Forum.jpg | 16.77 KB | ngmaloney |
Comments
Comment #1
himerus commentedsubscribe
Comment #2
damienmckenna