function hook_block_view_BASE_BLOCK_ID_alter

Provide a block plugin specific block_view alteration.

In this hook name, BASE_BLOCK_ID refers to the block implementation's plugin id, regardless of whether the plugin supports derivatives. For example, for the \Drupal\system\Plugin\block\block\SystemPoweredByBlock block, this would be 'system_powered_by_block' as per that class's annotation. And for the \Drupal\system\Plugin\block\block\SystemMenuBlock block, it would be 'system_menu_block' as per that class's annotation, regardless of which menu the derived block is for.

Parameters

array $build: A renderable array of data, as returned from the build() implementation of the plugin that defined the block:

  • #title: The default localized title of the block.

\Drupal\block\BlockPluginInterface $block: The block plugin instance.

See also

hook_block_view_alter()

Related topics

1 function implements hook_block_view_BASE_BLOCK_ID_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

menu_block_view_system_menu_block_alter in drupal/core/modules/menu/menu.module
Implements hook_block_view_BASE_BLOCK_ID_alter() for 'system_menu_block'.

File

drupal/core/modules/block/block.api.php, line 66
Hooks provided by the Block module.

Code

function hook_block_view_BASE_BLOCK_ID_alter(array &$build, \Drupal\block\BlockPluginInterface $block) {

  // Change the title of the specific block.
  $build['#title'] = t('New title of the block');
}