function BlockTestHooks::blockViewTestCacheAlter
Implements hook_block_view_BASE_BLOCK_ID_alter().
File
-
core/
modules/ block/ tests/ modules/ block_test/ src/ Hook/ BlockTestHooks.php, line 29
Class
- BlockTestHooks
- Hook implementations for block_test.
Namespace
Drupal\block_test\HookCode
public function blockViewTestCacheAlter(array &$build, BlockPluginInterface $block) : void {
if (\Drupal::state()->get('block_test_view_alter_suffix') !== NULL) {
$build['#attributes']['foo'] = 'bar';
}
if (\Drupal::state()->get('block_test_view_alter_append_pre_render_prefix') !== NULL) {
$build['#pre_render'][] = '\\Drupal\\block_test\\BlockRenderAlterContent::preRender';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.