a99945f5cc7b7688c2d5b83b73b7f20612894130
[yaffs-website] / FilterHtmlEscape.php
1 <?php
2
3 namespace Drupal\filter\Plugin\Filter;
4
5 use Drupal\filter\FilterProcessResult;
6 use Drupal\filter\Plugin\FilterBase;
7
8 /**
9  * Provides a filter to display any HTML as plain text.
10  *
11  * @Filter(
12  *   id = "filter_html_escape",
13  *   title = @Translation("Display any HTML as plain text"),
14  *   type = Drupal\filter\Plugin\FilterInterface::TYPE_HTML_RESTRICTOR,
15  *   weight = -10
16  * )
17  */
18 class FilterHtmlEscape extends FilterBase {
19
20   /**
21    * {@inheritdoc}
22    */
23   public function process($text, $langcode) {
24     return new FilterProcessResult(_filter_html_escape($text));
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function getHTMLRestrictions() {
31     // Nothing is allowed.
32     return ['allowed' => []];
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function tips($long = FALSE) {
39     return $this->t('No HTML tags allowed.');
40   }
41
42 }