As seen on http://api.drupal.org/api/drupal/modules%21block%21block.api.php/functio... and verified with local testing:
Can't remove blocks with hook_block_info_alter
Posted by Josh Waihi on February 22, 2012 at 10:53pm
Don't use this hook to unset blocks from other modules. Unlike other alter hooks, removing an index from this array won't help at all.Instead, it will prevent you from saving blocks to regions and it will clear your database table out for your configured theme.
Potentially this is a core bug, but I guess they never expected blocks to be removed.
We actually need this for Drupal.org and Aggregator blocks.
Comments
Comment #1
webchickCross-linking #1550044: Remove aggregator blocks from admin/structure/block
And major because it's an edge case, but there's a data loss component to it. Literally, all of your block associations disappear.
Comment #2
webchickTagging once more.
Comment #3
webchickTagging once more.
Comment #4
catchWhat's wrong with http://api.drupal.org/api/drupal/modules%21block%21block.api.php/functio... ?
Comment #5
webchickCATCH! YOU ARE MY FAVOURITE PERSON EVER!
I'm going to go try this.
Comment #6
webchickOops. Nope. We need to do something else. The list of modules at admin/structure/block, which right now looks like this:
Comment #7
webchickOh but you're still up there on my favourite people nonetheless. ;)
Comment #8
drummSolved a different way for Drupal.org.
Comment #9
webchickComment #10
catchThere's also hook_module_implements_alter(), would be good to know what the Drupal.org workaround was.
Comment #11
webchickOh, sorry. The workaround was in #1550044: Remove aggregator blocks from admin/structure/block.
In D7 we added a threshold setting to Aggregator module for the # of entries to include in a block, and when that number is set to 0, the block doesn't appear. Kind of stupid, but it works. :)
Comment #12
GuyPaddock CreditAttribution: GuyPaddock commentedStill major, still data loss...
Comment #13
chx CreditAttribution: chx commentedI quite disagree with this being major. It was only bumped cos d.o. needed it but that could be solved otherwise.
Comment #14
benjy CreditAttribution: benjy commentedhook_block_info_alter() has been removed from D8 so putting back to 7.x
Comment #15
ParisLiakos CreditAttribution: ParisLiakos commentedit *is* major, not to say critical..remove block keys from the array and *boom* Good luck rebuilding your blocks...and if your site heavily depends on them. well you are screwed. because you cant really remember the exact weight and visibility settings for every single one of them.
Comment #16
ParisLiakos CreditAttribution: ParisLiakos commentedComment #16.0
ParisLiakos CreditAttribution: ParisLiakos commentedUpdated issue summary.