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.
I don't know if this is by design, but I experience the following problem.
I alter the block subject in hook_block_view_alter() and it works for me provided I leave the subject empty in the block admin interface. As soon as you set the block title in the admin interface, then any changes you made are overwritten. Moving the hook implementation to the theme has no effect, so it is not a question of module weight.
Comments
Comment #1
dcam CreditAttribution: dcam commentedSee _block_render_blocks(). It's programmed to override subjects defined by hook_block_view() or hook_block_view_alter() with any custom title.