Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / filter / tests / filter_test / src / Plugin / Filter / FilterTestCacheContexts.php
1 <?php
2
3 namespace Drupal\filter_test\Plugin\Filter;
4
5 use Drupal\Core\Language\LanguageInterface;
6 use Drupal\filter\FilterProcessResult;
7 use Drupal\filter\Plugin\FilterBase;
8
9 /**
10  * Provides a test filter to associate cache contexts.
11  *
12  * @Filter(
13  *   id = "filter_test_cache_contexts",
14  *   title = @Translation("Testing filter"),
15  *   description = @Translation("Does not change content; associates cache contexts."),
16  *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE
17  * )
18  */
19 class FilterTestCacheContexts extends FilterBase {
20
21   /**
22    * {@inheritdoc}
23    */
24   public function process($text, $langcode) {
25     $result = new FilterProcessResult($text);
26     // The changes made by this filter are language-specific.
27     $result->addCacheContexts(['languages:' . LanguageInterface::TYPE_CONTENT]);
28     return $result;
29   }
30
31 }