Partials
Partials are structured content objects. Every partial has a type that defines it's available fields and layout when rendered.
Rendering Partials
To render the output for a partial you can use the render
method:
$output = $partial->render();
{{ partial.render|raw }}
You can also send along additional view data if needed:
$output = $partial->render(['name' => 'Ryan Thompson');
{{ partial.render({'name': 'Ryan Thompson'})|raw }}
Accessing Entry Fields
Note that when using the API you must access custom fields through the partials entry
relation:
$partial->entry->custom_field;
However within a view it is not necessary to use entry
because the PartialPresenter
maps entry fields automatically:
{{ partial.custom_field }}