Presenter Output

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

EditorFieldTypePresenter::path()

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

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

EditorFieldTypePresenter::render()

The render method returns the rendered view if the mode is twig, blade, or html.

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 }}

EditorFieldTypePresenter::parse()

The parse method runs the file contents through the view engine. This is great for parsing Twig in js or other files.

Returns: string
Arguments
Key Required Type Default Description

$payload

false

array

null

Additional payload data for the view.

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

EditorFieldTypePresenter::content()

The content method returns the raw value.

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

EditorFieldTypePresenter::__toString()

The __toString method is mapped to render for twig, blade, and html files and mapped to content for everything else.

Returns: string
Example
$decorated->example;
Twig
{{ decorated.example|raw }}
**Heads Up:** The **__toString** will not properly display exceptions spurring from value content.