Skip to content

Kirby 6.0.0

$page->toSafeHtmlString()

String template builder with automatic HTML escaping, marking the result as trusted HTML for the Panel. Use this over toSafeString() whenever the result is rendered as HTML rather than used as plain text.

$page->toSafeHtmlString(string|null $template = null, array $data = [], string|null $fallback = ''): HtmlString

Parameters

Name Type Default Description
$template stringornull null Template string or null to use the model ID
$data array []
$fallback stringornull '' Fallback for tokens in the template that cannot be replaced (null to keep the original token)

Return type

Kirby\Toolkit\HtmlString

Parent class

Kirby\Cms\Page inherited from Kirby\Cms\ModelWithContent