Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Blocks always have a renderable element named content in them. Lets get rid of that, now that #theme_wrappers can be an array. This simplifies the $page structure so our interesting content is less buried.
Comment | File | Size | Author |
---|---|---|---|
#7 | before.png | 30.3 KB | moshe weitzman |
#7 | after.png | 27.64 KB | moshe weitzman |
#2 | blockwrapper.diff | 1.74 KB | moshe weitzman |
blockwrapper.diff | 1.14 KB | moshe weitzman | |
Comments
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedFixed a sloppy loop in filter admin form.
I am seeing errors now in html corrector tests with and without my patch. probably some local problem. anyway, bot will hopefully clear it up.
Comment #3
Gábor HojtsyHow does this get rid of the content element?
Comment #4
Dries CreditAttribution: Dries commentedI don't get this patch. I mean, I understand what it does and support what it does, but I don't understand how it aligns with removing the 'content' element as mentioned in the description. It feels like there is a bit of a disconnect between the patch and the explanation. Confused. Care to elaborate, Moshe? Thanks would be helpful. Thanks!
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedI don't mean that it gets rid of the content *region*. Thats at the top level of $page. I refer to a deeper elelement also named 'content'. This gets rid of that useless level of nesting for all blocks in the $page structure. Does that clarify?
Comment #6
webchickCan you update the code example in hook_page_alter() where they explain how to reference blocks? Maybe that'd help alleviate confusion in this patch.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedgood idea webchick. but i looked and everything it says there is still accurate after this patch. It doesn't mention each block's 'content' key. It is prescient :)
Here are screenshots which illustrate the change. Note that 'content' is gone in the 'after' one.
Comment #8
webchickOh. Yay, us! :P
Committed to HEAD.
Comment #9
sunThe extra layer is not really useless IMHO. Consider administrative 'admin_links' that could be nicely stuffed into a sibling of 'content'.
Comment #10
moshe weitzman CreditAttribution: moshe weitzman commentedwhy would that be any better than putting it alongside the block content like we do for nodes and comments?