Hey,
Really handy module, so thanks for that, I found I needed to alter the blocks presented to a user based on their role and some other unrelated variables.
So I wrote this patch that does a simple drupal_alter() on the blocks before they get processed into a form element which lets me do those adjustments in a separate module without having to form_alter() the constructed form element.
Would be awesome if this can be merged into the next 6.x version if there is one planned, else its here for anyone that wants to use put it in their drush_make file :)
Cheers
Chris

Comments

rudiedirkx’s picture

Title: alter blocks before form » drupal_alter which blocks to show in the node form
Version: 6.x-1.4 » 7.x-1.x-dev
Priority: Normal » Major

Yes! But not D6. Who uses D6 anymore?

You'll need to pass some context to drupal alter though. Like $node. I recommend:

$context = array('node' => $node);
drupal_alter('node_level_blocks', $blocks, $context);

Do it, Johnny!

rudiedirkx’s picture

Opschieten Johnny!

Johnny vd Laar’s picture

Please keep this in English!

Johnny vd Laar’s picture

Status: Active » Fixed

I have committed a drupal_alter and cleaned up the code a bit in the process.

rudiedirkx’s picture

rudiedirkx’s picture

Johnny vd Laar’s picture

Yeah the comment is wrong after my change.

NLB doesn't need more then the blocks list. If the module that needs the full block object then it can still do a block_load I guess.

rudiedirkx’s picture

When you've fixed #1887042: Don't do a block rehash EVERY time the node form is loaded to make it faster this issue will resolve itself, because you need a new method to get all blocks instead of _block_rehash(). That new method would (hopefully) return full block objects.

I love me some full block objects!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 3ffecb2 on 7.x-1.x, 7.x-2.x by Johnny vd Laar:
    Issue #1679174 by chrisns,rudiedirkx: Added a node_level_blocks_alter...