{% if headlines is not defined %}
{% if config.headlines is defined %}
{% set headlines = config.headlines %}
{% else %}
{% set headlines = [] %}
{% endif %}
{% endif %}
{% for hl,opts in headlines %}
{% if opts is not iterable %}
{% set hl = opts %}
{% set opts = {} %}
{% endif %}
{% set hl_tag = opts.tag|default(hl) %}
{% if opts.autogenerate_id|default(false) %}
{% set headline_id = foxhabbit_common_html_id_from_string( pimcore_input(hl).getValue()|e('html')) %}
{% endif %}
{% if returnIdInPlaceholder|default(false) and headline_id is defined %}
{{ pimcore_placeholder( returnIdInPlaceholder).set(headline_id) }}
{% endif %}
{% if returnHeadlineInPlaceholder|default(false) %}
{{ pimcore_placeholder( returnHeadlineInPlaceholder).set(pimcore_input(hl).getValue()) }}
{% endif %}
{% if editmode or (opts.multiline|default(false) and pimcore_textarea(hl).getValue()) or (not opts.multiline|default(false) and pimcore_input(hl).getValue()) %}
<{{hl_tag}}
{% if opts.class is defined %}
class="{{ opts.class }}"
{% endif %}
{% if headline_id is defined %}
id="{{ headline_id }}"
{% endif %}
>
{%- if opts.prepend is defined and (editmode or pimcore_input(hl~'prepend').getValue()) -%}
{%- set prepend_opts = opts.prepend -%}
{%- if prepend_opts is not iterable -%}
{%- set prepend_opts = {tag:opts.prepend} -%}
{%- endif -%}
<{{prepend_opts.tag}}
{% if prepend_opts.class is defined %}
class="{{prepend_opts.class}}"
{% endif %}
>
{{- pimcore_input(hl~'prepend',{
required: prepend_opts.required is defined and prepend_opts.required ? true : false,
placeholder: prepend_opts.placeholder is defined ? prepend_opts.placeholder|upper : hl|upper~' '~prepend_opts.tag
}) -}}
</{{prepend_opts.tag}}>
{%- endif -%}
{% if opts.multiline|default(false) %}
{{- pimcore_textarea(hl,{
nl2br:false,
required: opts.required is defined and opts.required ? true : false,
placeholder: opts.placeholder is defined ? opts.placeholder|upper : hl|upper~' Headline'
}) -}}
{% else %}
{{- pimcore_input(hl,{
required: opts.required is defined and opts.required ? true : false,
placeholder: opts.placeholder is defined ? opts.placeholder|upper : hl|upper~' Headline'
}) -}}
{% endif %}
{%- if opts.append is defined -%}
{%- set append_opts = opts.append -%}
{%- if append_opts is not iterable -%}
{%- set append_opts = {tag:opts.append} -%}
{%- endif -%}
{%- if editmode or ( append_opts.multiline|default(false) and pimcore_textarea(hl~'append').getValue()) or ( not append_opts.multiline|default(false) and pimcore_input(hl~'append').getValue()) -%}
<{{append_opts.tag}}
{% if append_opts.class is defined %}
class="{{append_opts.class}}"
{% endif %}
>
{% if append_opts.multiline|default(false) %}
{{- pimcore_textarea(hl~'append',{
nl2br:false,
required: append_opts.required is defined and append_opts.required ? true : false,
placeholder: append_opts.placeholder is defined ? append_opts.placeholder|upper : hl|upper~' '~append_opts.tag
}) -}}
{% else %}
{{- pimcore_input(hl~'append',{
required: append_opts.required is defined and append_opts.required ? true : false,
placeholder: append_opts.placeholder is defined ? append_opts.placeholder|upper : hl|upper~' '~append_opts.tag
}) -}}
{% endif %}
</{{append_opts.tag}}>
{% endif -%}
{% endif -%}
</{{hl_tag}}>
{% endif %}
{% endfor %}
{% if lead is not defined %}
{% if config.lead is defined %}
{% set lead = config.lead %}
{% else %}
{% set lead = false %}
{% endif %}
{% endif %}
{% if lead %}
<div class="lead wysiwyg">
{{- pimcore_wysiwyg('lead',{placeholder:'Strong intro text'}) -}}
</div>
{% endif %}
{% if wysiwyg is not defined %}
{% if config.wysiwyg is defined %}
{% set wysiwyg = config.wysiwyg %}
{% else %}
{% set wysiwyg = true %}
{% endif %}
{% endif %}
{% if wysiwyg %}
<div class="wysiwyg">
{{- pimcore_wysiwyg('t',{placeholder:'Text part'}) -}}
</div>
{% endif %}