The arguments passed into hook_block_view_alter() have changed from versions of Backdrop prior to 1.8.0.

  • The $settings and $contexts arguments have been removed from hook_block_view_alter(). These are now accessible via $block->settings and $block->contexts.
  • hook_block_view_alter() is now called for all blocks. Prior to 1.8.0 it was only called for custom text blocks owned by block.module.
  • The data structure of $data now contains two keys: "title" and "content". Previously, "title" had been "subject".

Before:

hook_block_view_alter(&$data, $block, $settings = array(), $contexts = array()) {
  $bar = $settings['foo'];
  $node = $contexts['node'];
  $data['subject'] = t('A title from %node_title', array('%node_title' => $node->title);
}

After:

hook_block_view_alter(&$data, $block) {
  $bar = $block->settings['foo'];
  $node = $block->contexts['node'];
  $data['title'] = t('A title from %node_title', array('%node_title' => $node->title);
}
Introduced in branch: 
1.x
Introduced in version: 
1.8.0
Impacts: 
Module developers