Jody
0
Q:

drupal 8 block alter

function hook_block_build_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {

  // Add the 'user' cache context to some blocks.
  if ($some_condition) {
    $build['#cache']['contexts'][] = 'user';
  }
}
0

New to Communities?

Join the community