📅  最后修改于: 2022-03-11 15:00:49.849000             🧑  作者: Mango
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';
}
}