Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / block / block.api.php
index 4c7faf598c2f23f3bb31a6ee0a6601cbe9114118..284cddc3df649626211ca53cc7d1b1077120c8f1 100644 (file)
@@ -150,7 +150,7 @@ function hook_block_view_BASE_BLOCK_ID_alter(array &$build, \Drupal\Core\Block\B
  */
 function hook_block_build_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {
   // Add the 'user' cache context to some blocks.
-  if ($some_condition) {
+  if ($block->label() === 'some condition') {
     $build['#cache']['contexts'][] = 'user';
   }
 }