-
Notifications
You must be signed in to change notification settings - Fork 393
Issue #6893: Add a block render function outside layouts #5076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.x
Are you sure you want to change the base?
Conversation
Related to: backdrop/backdrop-issues#6893 |
Move block render code outside layouts This commit moves the block render code outside layouts so that third party modules can render blocks without having to re-implement core code.
I totally borked this block_render function.
After looking through this, it appears that layout module doesn't require the block module so it was throwing an error about not finding block functions. I figured we probablty didn't want to make layout depend on block so I've moved those functions into the layout module. Fixes backdrop/backdrop-issues#6893
50a448f
to
696e43f
Compare
I had to change a few things to get the test to run -- namely after the block hooks run it returns a string instead of an array. In order to get the layout contextual links to be added I had to switch it back to an array. I'm not super happy about how that code is, but I'm going to tackle that in another commit. Fixes backdrop/backdrop-issues#6893
I've moved layout_block_get_renderable_array to the Block class which I think I kind of like. I renamed it getRenderArray() for brevity and I think they're called render arrays in the documentation. I didn't like that the function assumed that $block_prepare() was called, so I've added a new property to the block class $isPrepared that we can check in getRenderArray(). Fixes backdrop/backdrop-issues#6893
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bennybobw generally it looks good! I added a few suggested changes for consistency. I haven't tested this at all.
core/modules/layout/plugins/renderers/layout_renderer_standard.inc
Outdated
Show resolved
Hide resolved
core/modules/layout/plugins/renderers/layout_renderer_standard.inc
Outdated
Show resolved
Hide resolved
core/modules/layout/plugins/renderers/layout_renderer_standard.inc
Outdated
Show resolved
Hide resolved
Co-authored-by: Herb <[email protected]>
Co-authored-by: Herb <[email protected]>
Changed getRenderArray() to build(). Made some documentation changes.
Tugboat has finished building a preview for this pull request! Website: https://pr5076-dpodjcpubcljnovljnmlbz4gftblsuue.tugboatqa.com/ This preview will automatically expire on the 6th of August, 2025. |
This is my first time using this "requested changes" feature so I apologize if I've messed it up. I clicked the button to include some of your changes and then also made a commit. |
Fixes backdrop/backdrop-issues#6893