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().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstef’s picture

Status: Active » Needs review
FileSize
875 bytes

Patch

Johnny vd Laar’s picture

Status: Needs review » Closed (works as designed)

I 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.

Johnny vd Laar’s picture

Oh 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...