FilterHtmlCorrector.php

Same filename in other branches
  1. 9 core/modules/filter/src/Plugin/Filter/FilterHtmlCorrector.php
  2. 10 core/modules/filter/src/Plugin/Filter/FilterHtmlCorrector.php
  3. 11.x core/modules/filter/src/Plugin/Filter/FilterHtmlCorrector.php

Namespace

Drupal\filter\Plugin\Filter

File

core/modules/filter/src/Plugin/Filter/FilterHtmlCorrector.php

View source
<?php

namespace Drupal\filter\Plugin\Filter;

use Drupal\Component\Utility\Html;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;

/**
 * Provides a filter to correct faulty and chopped off HTML.
 *
 * @Filter(
 *   id = "filter_htmlcorrector",
 *   title = @Translation("Correct faulty and chopped off HTML"),
 *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE,
 *   weight = 10
 * )
 */
class FilterHtmlCorrector extends FilterBase {
    
    /**
     * {@inheritdoc}
     */
    public function process($text, $langcode) {
        return new FilterProcessResult(Html::normalize($text));
    }

}

Classes

Title Deprecated Summary
FilterHtmlCorrector Provides a filter to correct faulty and chopped off HTML.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.