get('block_test.content'); $build = []; if (!empty($content)) { $build['#markup'] = $content; } return $build; } /** * {@inheritdoc} */ public function getCacheContexts() { return \Drupal::state()->get('block_test.cache_contexts', []); } /** * {@inheritdoc} */ public function getCacheMaxAge() { return \Drupal::state()->get('block_test.cache_max_age', parent::getCacheMaxAge()); } }