wiki-grav/plugins/flex-objects/templates/flex-objects/views/object.html.twig
2022-04-24 14:32:58 +02:00

24 lines
687 B
Twig

{# flex-objects/views/object.html.twig #}
{% set flex = grav.get('flex_objects') %}
{% set directory = flex.directory(type) %}
{% set object = directory.getObject(id) %}
{% if object %}
{%- set title = options.title -%}
{%- if title matches '/\{/' -%}
{%- set title = include(template_from_string(title, 'object title template'))|trim -%}
{%- endif -%}
{% if title %}
{% do page.title(title) %}
{% endif %}
{% set layout = options.layout ?? 'default' %}
{% set context = options ?? {} %}
{% render object layout: layout with context|merge({title: title}) %}
{% else %}
{% include 'flex-objects/views/404.html.twig' %}
{% endif %}