You are here

class FilterHtmlEscape in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/filter/src/Plugin/Filter/FilterHtmlEscape.php \Drupal\filter\Plugin\Filter\FilterHtmlEscape
  2. 9 core/modules/filter/src/Plugin/Filter/FilterHtmlEscape.php \Drupal\filter\Plugin\Filter\FilterHtmlEscape

Provides a filter to display any HTML as plain text.

Plugin annotation


@Filter(
  id = "filter_html_escape",
  title = @Translation("Display any HTML as plain text"),
  type = Drupal\filter\Plugin\FilterInterface::TYPE_HTML_RESTRICTOR,
  weight = -10
)

Hierarchy

Expanded class hierarchy of FilterHtmlEscape

File

core/modules/filter/src/Plugin/Filter/FilterHtmlEscape.php, line 18

Namespace

Drupal\filter\Plugin\Filter
View source
class FilterHtmlEscape extends FilterBase {

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

  /**
   * {@inheritdoc}
   */
  public function getHTMLRestrictions() {

    // Nothing is allowed.
    return [
      'allowed' => [],
    ];
  }

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

}

Members