function TestCacheBlock::getCacheContexts

Same name in other branches
  1. 9 core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php \Drupal\block_test\Plugin\Block\TestCacheBlock::getCacheContexts()
  2. 8.9.x core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php \Drupal\block_test\Plugin\Block\TestCacheBlock::getCacheContexts()
  3. 11.x core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php \Drupal\block_test\Plugin\Block\TestCacheBlock::getCacheContexts()

Overrides ContextAwarePluginTrait::getCacheContexts

File

core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php, line 34

Class

TestCacheBlock
Provides a block to test caching.

Namespace

Drupal\block_test\Plugin\Block

Code

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

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