Skip to content

Kirby 6.0.0

$field->escape()

Escapes the field value to be safely used in HTML templates without the risk of XSS attacks

$field->escape(string $context = 'html'): Field

Parameters

Name Type Default Description
$context string 'html' Location of output (html, attr, js, css, url or xml)

Return type

Kirby\Content\Field

This method does not modify the existing $field object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Content\Field