function Html::normalize
Same name in other branches
- 9 core/lib/Drupal/Component/Utility/Html.php \Drupal\Component\Utility\Html::normalize()
- 8.9.x core/lib/Drupal/Component/Utility/Html.php \Drupal\Component\Utility\Html::normalize()
- 11.x 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.
9 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.
- FilterKernelTest::testHtmlCorrectorFilter in core/
modules/ filter/ tests/ src/ Kernel/ FilterKernelTest.php - Tests the HTML corrector filter.
File
-
core/
lib/ Drupal/ Component/ Utility/ Html.php, line 259
Class
- Html
- Provides DOMDocument helpers for parsing and serializing HTML strings.
Namespace
Drupal\Component\UtilityCode
public static function normalize($html) {
$document = static::load($html);
return static::serialize($document);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.