function TestCacheOptionalBlock::getCacheContexts

Overrides ContextAwarePluginTrait::getCacheContexts

File

core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheOptionalBlock.php, line 37

Class

TestCacheOptionalBlock
Provides a block implementing CacheOptionalInterface to test its caching.

Namespace

Drupal\block_test\Plugin\Block

Code

public function getCacheContexts() : array {
  return \Drupal::state()->get('block_test.cache_contexts', parent::getCacheContexts());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.