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.
Core block functions should be used to handle rehashing the block info instead of doing it manually; for a number of reasons. This will also allow people to use hook_block_info_alter() to *remove* certain blocks without throwing errors in nodeblock_node_insert().
Comment | File | Size | Author |
---|---|---|---|
#1 | nodeblock-use_core_block_rehash-2158713-1.patch | 875 bytes | mstef |
Comments
Comment #1
mstef CreditAttribution: mstef commentedPatch
Comment #2
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedI intentionally didn't use _block_rehash because it is quite a heavy operation and I already know which block to change. Perhaps we should invoke drupal_alter('block_info', $current_blocks, $theme, $code_blocks); on the single block. But this function kinda is meant for a complete list of blocks.
But if you don't want a block to be created then you just shouldn't check the "Create a block for this node" checkbox or implement a hook_node_insert / update that sets the checkbox to false.
Comment #3
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedOh I see that we already do a block_info_alter. I've modified the code a little but such that you can unset the block if you want to and don't get a notice:
http://drupalcode.org/project/nodeblock.git/blobdiff/f7ff7a4089322651c7d...