Presenter Output

This section will show you how to use the decorated value provided by the \Anomaly\WysiwygFieldType\WysiwygFieldTypePresenter class.

WysiwygFieldTypePresenter::path()

The path method returns the prefix hinted path to the storage file.

Returns: string
Example
$decorated->example->path(); // storage::the/path/example.html
Twig
{{ decorated.example.path() }} // storage::the/path/example.html

WysiwygFieldTypePresenter::render()

The render method returns the rendered view using the storage file.

Returns: string
Arguments
Key Required Type Default Description

$payload

false

array

null

Additional payload data for the view.

Example
$decorated->example->render(['name' => 'Ryan']);
Twig
{{ decorated.example.render({'name': 'Ryan'})|raw }}

WysiwygFieldTypePresenter::content()

The content method returns the raw value.

Returns: string
Example
$decorated->example->content();
Twig
{{ decorated.example.content() }}

WysiwygFieldTypePresenter::excerpt()

The excerpt method returns a limited snippet from the text method while preserving whole words.

Returns: string
Arguments
Key Required Type Default Description

$length

false

integer

100

The length to limit the value by.

$end

false

string

...

The ending for the string only if truncated.

Example
$decorated->example->excerpt();
Twig
{{ decorated.example.excerpt() }}

WysiwygFieldTypePresenter::text()

The text method returns the text-only content from the storage file.

Returns: string
Arguments
Key Required Type Default Description

$allowed

false

string

none

The string of tags to allow.

Example
$decorated->example->text();
Twig
{{ decorated.example.text() }}

WysiwygFieldTypePresenter::__toString()

The __toString method is mapped to the render method.

Returns: string
Example
$decorated->example;
Twig
{{ decorated.example|raw }}

The __toString will not properly display exceptions spurring from value content.{.note}