summaryrefslogtreecommitdiffstats
path: root/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtmlEscape.php
blob: f4a3694179139c76e24b8cd0196c4cb154524b69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

/**
 * @file
 * Contains \Drupal\filter\Plugin\Filter\FilterHtmlEscape.
 */

namespace Drupal\filter\Plugin\Filter;

use Drupal\filter\Annotation\Filter;
use Drupal\Core\Annotation\Translation;
use Drupal\filter\Plugin\FilterBase;

/**
 * Provides a filter to display any HTML as plain text.
 *
 * @Filter(
 *   id = "filter_html_escape",
 *   module = "filter",
 *   title = @Translation("Display any HTML as plain text"),
 *   type = FILTER_TYPE_HTML_RESTRICTOR,
 *   weight = -10
 * )
 */
class FilterHtmlEscape extends FilterBase {

  /**
   * {@inheritdoc}
   */
  public function process($text, $langcode, $cache, $cache_id) {
    return _filter_html_escape($text);
  }

  /**
   * {@inheritdoc}
   */
  public function tips($long = FALSE) {
    return t('No HTML tags allowed.');
  }

}