Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / filter / tests / filter_test / src / Plugin / Filter / FilterTestCacheMerge.php
1 <?php
2
3 namespace Drupal\filter_test\Plugin\Filter;
4
5 use Drupal\filter\FilterProcessResult;
6 use Drupal\filter\Plugin\FilterBase;
7 use Drupal\Core\Cache\CacheableMetadata;
8
9 /**
10  * Provides a test filter to merge with CacheableMetadata.
11  *
12  * @Filter(
13  *   id = "filter_test_cache_merge",
14  *   title = @Translation("Testing filter"),
15  *   description = @Translation("Does not change content; merges cacheable metadata."),
16  *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE
17  * )
18  */
19 class FilterTestCacheMerge extends FilterBase {
20
21   /**
22    * {@inheritdoc}
23    */
24   public function process($text, $langcode) {
25     $result = new FilterProcessResult($text);
26
27     $metadata = new CacheableMetadata();
28     $metadata->addCacheTags(['merge:tag']);
29     $metadata->addCacheContexts(['user.permissions']);
30     $result = $result->merge($metadata);
31
32     return $result;
33   }
34
35 }