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.
Problem/Motivation
We should be able to reposition, enable, and create blocks using hook_block_info_alter()
, but it is only invoked in _block_rehash
, and for some reason _block_rehash does the exact opposite right below a comment stating intent to this effect, and in fact deletes the inactive block that we are trying to reposition.
Proposed resolution
Make the code not blatantly incorrect.
Remaining tasks
- Merge the patch.
- Perhaps remove the delete query at the end of the function, since it seems to serve no purpose whatsoever.
User interface changes
When a module that implements hook_block_info_alter()
is active, the blocks it did not accidentally delete will be available for the user to configure.
API changes
Calling _block_rehash
is less likely to delete blocks that you did not want deleted.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2175279_1.patch | 1.48 KB | wamilton |
Comments
Comment #1
wamilton CreditAttribution: wamilton commentedPatch attached.