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.