function FilterTestCacheContexts::process

Same name in other branches
  1. 9 core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheContexts.php \Drupal\filter_test\Plugin\Filter\FilterTestCacheContexts::process()
  2. 8.9.x core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheContexts.php \Drupal\filter_test\Plugin\Filter\FilterTestCacheContexts::process()
  3. 10 core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheContexts.php \Drupal\filter_test\Plugin\Filter\FilterTestCacheContexts::process()

Overrides FilterInterface::process

File

core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheContexts.php, line 28

Class

FilterTestCacheContexts
Provides a test filter to associate cache contexts.

Namespace

Drupal\filter_test\Plugin\Filter

Code

public function process($text, $langcode) {
    $result = new FilterProcessResult($text);
    // The changes made by this filter are language-specific.
    $result->addCacheContexts([
        'languages:' . LanguageInterface::TYPE_CONTENT,
    ]);
    return $result;
}

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