Class HtmlString
An immutable value containing developer-controlled HTML.
This class marks markup as trusted; it does not sanitize it.
Method Summary
-
__construct() public
Wrap trusted markup without escaping it.
-
__toString() public
Return the original markup.
-
jsonSerialize() public
Serialize the markup as a JSON string.
-
render() public static
Render content by escaping ordinary text and preserving explicitly trusted HTML.
Method Detail
__construct() ¶ public
__construct(string $value)
Wrap trusted markup without escaping it.
Parameters
-
string$value The trusted HTML.
jsonSerialize() ¶ public
jsonSerialize(): string
Serialize the markup as a JSON string.
Returns
stringrender() ¶ public static
render(Cake\View\HtmlStringable|string $text): string
Render content by escaping ordinary text and preserving explicitly trusted HTML.
Parameters
-
Cake\View\HtmlStringable|string$text Text or trusted markup to render.
Returns
string