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.
If you create a block manually in admin/build/block/add Drupal will tell you "The block has been created" and the block will show up in the 'boxes' database table but will not appear in admin/build/block.
Comment | File | Size | Author |
---|---|---|---|
#4 | block_manual_add_2.patch | 902 bytes | Zack Rosen |
#1 | block_manual_add_1.patch | 889 bytes | Zack Rosen |
Comments
Comment #1
Zack Rosen CreditAttribution: Zack Rosen commentedHere is a patch but I'm not sure if this is the optimal fix.
The problem was that the patch to add configurable block titles changed the query used to generate the list of manualy created blocks in the block_block() function so that it would load the block titles from the block table in addition to the data stored in the boxes table:
$result = db_query("SELECT bid, bl.title, info FROM {boxes} bx INNER JOIN {blocks} bl ON bx.bid = bl.delta WHERE module = 'block' ORDER BY title");
This creates a problem because the _block_rehash() function automatically creates the data in the block table from the _block() list hook.... which of course will never return the manually created blocks because they were never set. This patch simply removes the join on the blocks table.
Comment #2
Zack Rosen CreditAttribution: Zack Rosen commentedComment #3
drummRemoving check_plain() and the surrounding logic seems like a mistake.
Comment #4
Zack Rosen CreditAttribution: Zack Rosen commentedI added back in the check_plain() for $info.
I don't think we have to fall back on the block title as it's description anymore since descriptions are now required for all blocks as of rev 1.176 :
http://tinyurl.com/s8n88
Comment #5
Zack Rosen CreditAttribution: Zack Rosen commentedComment #6
Jaza CreditAttribution: Jaza commentedTested, works, code looks reasonable to me. RTBC.
Comment #7
drummCommitted to HEAD.
Comment #8
drummPlease reopen if you want to do more cleanup and remove that ORDER BY which I suspect is useless.
Comment #9
(not verified) CreditAttribution: commented