You are here

public static function Html::normalize in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Utility/Html.php \Drupal\Component\Utility\Html::normalize()

Normalizes an HTML snippet.

This function is essentially \DOMDocument::normalizeDocument(), but operates on an HTML string instead of a \DOMDocument.

Parameters

string $html: The HTML string to normalize.

Return value

string The normalized HTML string.

7 calls to Html::normalize()
FieldFilteredMarkup::create in core/lib/Drupal/Core/Field/FieldFilteredMarkup.php
Overrides \Drupal\Component\Render\MarkupTrait::create().
FieldPluginBase::trimText in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
Trims the field down to the specified length.
FilterHtmlCorrector::process in core/modules/filter/src/Plugin/Filter/FilterHtmlCorrector.php
Performs the filter processing.
FilterUnitTest::testHtmlCorrectorFilter in core/modules/filter/src/Tests/FilterUnitTest.php
Tests the HTML corrector filter.
MailFormatHelper::htmlToText in core/lib/Drupal/Core/Mail/MailFormatHelper.php
Transforms an HTML string into plain text, preserving its structure.

... See full list

File

core/lib/Drupal/Component/Utility/Html.php, line 236
Contains \Drupal\Component\Utility\Html.

Class

Html
Provides DOMDocument helpers for parsing and serializing HTML strings.

Namespace

Drupal\Component\Utility

Code

public static function normalize($html) {
  $document = static::load($html);
  return static::serialize($document);
}