final class FilteredMarkup implements MarkupInterface, Countable (View source)

internal  This object is marked as internal because it should only be used in the Filter module on strings that have already been been filtered and sanitized in \Drupal\filter\Plugin\FilterInterface.
 

Defines an object that passes markup through the Filter system.

This object should only be constructed with markup that is safe to render. If there is any risk that the string contains user-entered data that has not been filtered first, it must not be used.

Traits

Implements MarkupInterface and Countable for rendered objects.

Properties

protected string $string

The safe string.

from  MarkupTrait

Methods

static string|MarkupInterface
create(mixed $string)

Creates a Markup object if necessary.

string
__toString()

Returns the string version of the Markup object.

int
count()

Returns the string length.

string
jsonSerialize()

Returns a representation of the object for use in JSON serialization.

Details

static string|MarkupInterface create(mixed $string)

Creates a Markup object if necessary.

If $string is equal to a blank string then it is not necessary to create a Markup object. If $string is an object that implements MarkupInterface it is returned unchanged.

Parameters

mixed $string

The string to mark as safe. This value will be cast to a string.

Return Value

string|MarkupInterface

A safe string.

string __toString()

Returns the string version of the Markup object.

Return Value

string

The safe string content.

int count()

Returns the string length.

Return Value

int

The length of the string.

string jsonSerialize()

Returns a representation of the object for use in JSON serialization.

Return Value

string

The safe string content.