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

Breadcrumb

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

function HTML5::saveHTML

Convert a DOM into an HTML5 string.

Parameters

mixed $dom The DOM to be serialized.:

array $options Configuration options when serializing the DOM. These include::

  • encode_entities: Text written to the output is escaped by default and not all

entities are encoded. If this is set to true all entities will be encoded. Defaults to false.

Return value

string A HTML5 documented generated from the DOM.

File

vendor/masterminds/html5/src/HTML5.php, line 235

Class

HTML5
This class offers convenience methods for parsing and serializing HTML5. It is roughly designed to mirror the \DOMDocument native class.

Namespace

Masterminds

Code

public function saveHTML($dom, $options = array()) {
    $stream = fopen('php://temp', 'wb');
    $this->save($dom, $stream, array_merge($this->defaultOptions, $options));
    $html = stream_get_contents($stream, -1, 0);
    fclose($stream);
    return $html;
}
RSS feed
Powered by Drupal