Version 1
[yaffs-website] / web / core / modules / filter / tests / filter_test / src / Plugin / Filter / FilterTestCacheTags.php
diff --git a/web/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheTags.php b/web/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheTags.php
new file mode 100644 (file)
index 0000000..4b30505
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Drupal\filter_test\Plugin\Filter;
+
+use Drupal\filter\FilterProcessResult;
+use Drupal\filter\Plugin\FilterBase;
+
+/**
+ * Provides a test filter to associate cache tags
+ *
+ * @Filter(
+ *   id = "filter_test_cache_tags",
+ *   title = @Translation("Testing filter"),
+ *   description = @Translation("Does not change content; associates cache tags."),
+ *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE
+ * )
+ */
+class FilterTestCacheTags extends FilterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function process($text, $langcode) {
+    $result = new FilterProcessResult($text);
+    $result->addCacheTags(['foo:bar']);
+    $result->addCacheTags(['foo:baz']);
+    return $result;
+  }
+
+}