.../modules/system/src/Plugin/Block/SystemMainBlock.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/core/modules/system/src/Plugin/Block/SystemMainBlock.php b/core/modules/system/src/Plugin/Block/SystemMainBlock.php index 3d2d45e..aa63110 100644 --- a/core/modules/system/src/Plugin/Block/SystemMainBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemMainBlock.php @@ -9,6 +9,7 @@ use Drupal\Core\Block\BlockBase; use Drupal\Core\Block\MainContentBlockPluginInterface; +use Drupal\Core\Cache\Cache; use Drupal\Core\Form\FormStateInterface; /** @@ -45,23 +46,15 @@ public function build() { /** * {@inheritdoc} */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - $form = parent::buildConfigurationForm($form, $form_state); - - // The main content block is never cacheable, because it may be dynamic. - $form['cache']['#disabled'] = TRUE; - $form['cache']['#description'] = $this->t('This block is never cacheable, it is not configurable.'); - $form['cache']['max_age']['#value'] = 0; - - return $form; + public function getCacheMaxAge() { + return Cache::PERMANENT; } /** * {@inheritdoc} */ - public function getCacheMaxAge() { - // The main content block is never cacheable, because it may be dynamic. - return 0; + public function getCacheContexts() { + return ['route']; } }