Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Html.php

function 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.

6 calls to Html::normalize()
BigPipeStrategy::placeholderIsAttributeSafe in core/modules/big_pipe/src/Render/Placeholder/BigPipeStrategy.php
Determines whether the given placeholder is attribute-safe or not.
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.
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 259

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal