Html::resetSeenIds

public static Html::resetSeenIds() Resets the list of seen IDs. File core/lib/Drupal/Component/Utility/Html.php, line 234 Class Html Provides DOMDocument helpers for parsing and serializing HTML strings. Namespace Drupal\Component\Utility Code public static function resetSeenIds() { static::$seenIds = NULL; }

Html::normalize

public static Html::normalize($html) 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. File core/lib/Drupal/Component/Utility/Html.php, line 250 Class Html Provides DOMDocument helpers for parsing and serializing HTML strings. Namespace Drupal\Component\Utility Code public static func

Html::load

public static Html::load($html) Parses an HTML snippet and returns it as a DOM object. This function loads the body part of a partial (X)HTML document and returns a full \DOMDocument object that represents this document. Use \Drupal\Component\Utility\Html::serialize() to serialize this \DOMDocument back to a string. Parameters string $html: The partial (X)HTML snippet to load. Invalid markup will be corrected on import. Return value \DOMDocument A \DOMDocument that represents the loaded (X)HT

Html::getUniqueId

public static Html::getUniqueId($id) Prepares a string for use as a valid HTML ID and guarantees uniqueness. This function ensures that each passed HTML ID value only exists once on the page. By tracking the already returned ids, this function enables forms, blocks, and other content to be output multiple times on the same page, without breaking (X)HTML validation. For already existing IDs, a counter is appended to the ID string. Therefore, JavaScript and CSS code should not rely on any value t

Html::getInfo

public Html::getInfo() Returns the element properties for this element. Return value array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format. Overrides ElementInterface::getInfo File core/lib/Drupal/Core/Render/Element/Html.php, line 15 Class Html Provides a render element for an entire HTML page: <html> plus its children. Namespace Drupal\Core\Re

Html::getId

public static Html::getId($id) Prepares a string for use as a valid HTML ID. Only use this function when you want to intentionally skip the uniqueness guarantee of self::getUniqueId(). Parameters string $id: The ID to clean. Return value string The cleaned ID. See also self::getUniqueId() File core/lib/Drupal/Component/Utility/Html.php, line 215 Class Html Provides DOMDocument helpers for parsing and serializing HTML strings. Namespace Drupal\Component\Utility Code public static fun

Html::getClass

public static Html::getClass($class) Prepares a string for use as a valid class name. Do not pass one string containing multiple classes as they will be incorrectly concatenated with dashes, i.e. "one two" will become "one-two". Parameters string $class: The class name to clean. Return value string The cleaned class name. File core/lib/Drupal/Component/Utility/Html.php, line 70 Class Html Provides DOMDocument helpers for parsing and serializing HTML strings. Namespace Drupal\Component

Html::escapeCdataElement

public static Html::escapeCdataElement(\DOMNode $node, $comment_start = '//', $comment_end = '') Adds comments around a <!CDATA section in a \DOMNode. \DOMDocument::loadHTML() in \Drupal\Component\Utility\Html::load() makes CDATA sections from the contents of inline script and style tags. This can cause HTML4 browsers to throw exceptions. This function attempts to solve the problem by creating a \DOMDocumentFragment to comment the CDATA tag. Parameters \DOMNode $node: The element potentiall

Html::escape

public static Html::escape($text) Escapes text by converting special characters to HTML entities. This method escapes HTML for sanitization purposes by replacing the following special characters with their HTML entity equivalents: & (ampersand) becomes &amp; " (double quote) becomes &quot; ' (single quote) becomes &#039; < (less than) becomes &lt; > (greater than) becomes &gt; Special characters that have already been escaped will be double-escaped (for example,

Html::decodeEntities

public static Html::decodeEntities($text) Decodes all HTML entities including numerical ones to regular UTF-8 bytes. Double-escaped entities will only be decoded once ("&amp;lt;" becomes "&lt;", not "<"). Be careful when using this function, as it will revert previous sanitization efforts (&lt;script&gt; will become <script>). This method is not the opposite of Html::escape(). For example, this method will convert "&eacute;" to "é", whereas Html::escape() will not c