Html

Provides DOMDocument helpers for parsing and serializing HTML strings.

Hierarchy

  • class \Drupal\Component\Utility\Html

Related topics

Utility classes and functions
Overview of utility classes and functions for developers.

File

core/lib/Drupal/Component/Utility/Html.php, line 10

Namespace

Drupal\Component\Utility

Members

Name Modifiers Type Description
Html::$classes protected static property An array of previously cleaned HTML classes.
Html::$isAjax protected static property Stores whether the current request was sent via AJAX.
Html::$seenIds protected static property An array of IDs, including incremented versions when an ID is duplicated.
Html::$seenIdsInit protected static property An array of the initial IDs used in one request.
Html::$uriAttributes protected static property All attributes that may contain URIs.
Html::cleanCssIdentifier public static function Prepares a string for use as a CSS identifier (element, class, or ID name).
Html::decodeEntities public static function Decodes all HTML entities including numerical ones to regular UTF-8 bytes.
Html::escape public static function Escapes text by converting special characters to HTML entities.
Html::escapeCdataElement public static function Adds comments around a <!CDATA section in a \DOMNode.
Html::getClass public static function Prepares a string for use as a valid class name.
Html::getId public static function Prepares a string for use as a valid HTML ID.
Html::getUniqueId public static function Prepares a string for use as a valid HTML ID and guarantees uniqueness.
Html::load public static function Parses an HTML snippet and returns it as a DOM object.
Html::normalize public static function Normalizes an HTML snippet.
Html::resetSeenIds public static function Resets the list of seen IDs.
Html::serialize public static function Converts the body of a \DOMDocument back to an HTML snippet.
Html::setIsAjax public static function Sets if this request is an Ajax request.
Html::transformRootRelativeUrlsToAbsolute public static function Converts all root-relative URLs to absolute URLs.
doc_Drupal
2016-10-29 09:18:41
Comments
Leave a Comment

Please login to continue.