I was quite surprised to see that neither this is available as a feature or that no one requested it here (as far as I can tell).

Comments

mstef’s picture

I was going to use hook_block_info_alter() to remove them, but not after I saw this line and realized that would throw errors:

        drupal_alter('block_info', $blocks, $theme, $blocks);
        drupal_write_record('block', $blocks['nodeblock'][$node->nid]);

And while I'm asking, why insert it directly and not just declare it in hook_block_info()?

mstef’s picture

Should be: (you did reference the function you need too..)

    // Rehash block list with this new block for all active themes.
    // @see _block_rehash().
    $themes = list_themes();
    foreach ($themes as $theme) {
      if ($theme->status) {
        _block_rehash($theme->name);
      }
    }

I'll provide a patch. That way I can at least use an alter hook properly without causing an eror from the drupal_write_record() that is in there.

mstef’s picture

Here's an issue an patch for the _block_rehash(): #2158713: Use core functions to rehash blocks after node insert

I'll leave this option because I still feel this would be a great, and much needed, feature for this module (without having to hook in).

Johnny vd Laar’s picture

Status: Active » Closed (works as designed)

I've closed your related issue. As described in that issue you can now do this with a proper block_info_alter. I don't think I want to add yet another interface option for this.