{# If this item type is a widget output a standard widget wrapper, with data attributes #} {%- if options.widget -%} {% if options.widgetClass %} {% set widgetClass = options.widgetClass %} {% endif %} {% if item.orientation %} {% set orientation = item.orientation %} {% endif %}
{%- elif alwaysEditing and item.type == 'richText' -%} {# This outer wrapper must exist for rich text too, to contain buttons #} {# Keep in sync with richText.html #}
{%- endif -%} {# If this item type has a wrapper element output that element, with an optional #} {# CSS class as well. Helps implement widgets like pullquote and code sample #} {%- if itemType.wrapper -%} <{{ itemType.wrapper }}{%- if itemType.wrapperClass %} class="{{ itemType.wrapperClass }}" {% endif -%}> {%- endif -%} {% if alwaysEditing and item.type == 'richText' %} {# This is the div that actually becomes contenteditable. Cannot contain anything but rich text #}
{% endif %} {# If this item type has plaintext content, output that content, escaped for HTML #} {%- if itemType.plaintext -%} {{ item.content | e }} {%- endif -%} {# If this item type contains markup, output the markup, unescaped #} {%- if itemType.markup -%} {{ item.content }} {%- endif -%} {# If this content type has a custom renderer, invoke that #} {# Note that you can use the various simple wrapper options above too, or #} {# just have a renderer that does its own wrapping #} {%- if itemType.render -%} {{ itemType.render({ item: item, options: options }) }} {%- endif -%} {% if alwaysEditing and item.type == 'richText' %}
{% endif %} {# If this item type has a wrapper close the wrapper #} {%- if itemType.wrapper -%} {%- endif -%} {% if options.widget or (alwaysEditing and item.type == 'richText' ) %}
{% endif %} {# Widgets and rich texts both are wrapped in divs #}