function hook_block_build_BASE_BLOCK_ID_alter

Same name in other branches
  1. 9 core/modules/block/block.api.php \hook_block_build_BASE_BLOCK_ID_alter()
  2. 8.9.x core/modules/block/block.api.php \hook_block_build_BASE_BLOCK_ID_alter()
  3. 11.x core/modules/block/block.api.php \hook_block_build_BASE_BLOCK_ID_alter()

Provide a block plugin specific block_build 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\SystemPoweredByBlock block, this would be 'system_powered_by_block' as per that class's annotation. And for the \Drupal\system\Plugin\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, only containing #cache.

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

See also

hook_block_build_alter()

Entity CRUD, editing, and view hooks

Related topics

3 functions implement hook_block_build_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.

block_block_build_local_actions_block_alter in core/modules/block/block.module
Implements hook_block_build_BASE_BLOCK_ID_alter().
block_test_block_build_test_cache_alter in core/modules/block/tests/modules/block_test/block_test.module
Implements hook_block_build_BASE_BLOCK_ID_alter().
navigation_block_build_local_tasks_block_alter in core/modules/navigation/navigation.module
Implements hook_block_build_BASE_BLOCK_ID_alter().

File

core/modules/block/block.api.php, line 180

Code

function hook_block_build_BASE_BLOCK_ID_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {
    // Explicitly enable placeholdering of the specific block.
    $build['#create_placeholder'] = TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.