{# @var craft \craft\web\twig\variables\CraftVariable #} {# @var entry \craft\elements\Entry #} {# Description of what this file is for @package baukasten @author David Hellmann [davidhellmann.com@gmail.com] o-contactForm ------------------------------------------------------------ #} {# -- Set Defaults -- #} {% set defaults = { cn: 'o-contactForm', modifiers: [], customClasses: [], data: {}, js: null, form: null } %} {# -- Merge Default with Options -- #} {% set opt = opt is defined ? defaults|merge(opt) : defaults %} {# -- Modul -- #}
{# -- input -- #} {% include '_atoms/input/_template.html' with { opt: { type: 'text', name: name.handle, value: name.value, label: name.label, info: 'Please type in your name' | t, required: false } } only %} {{ name.renderErrors() }}
{# -- input -- #} {% include '_atoms/input/_template.html' with { opt: { customClasses: [''], type: 'email', name: mail.handle, value: mail.valueAsString, label: mail.label, info: 'Please type in your mail' | t, required: false } } only %} {{ mail.renderErrors() }}
{# -- textarea -- #} {% include '_atoms/textarea/_template.html' with { opt: { name: message.handle, label: message.label, info: 'Please type in your message' | t, required: false } } only %} {{ message.renderErrors() }}
{% if form.hasErrors %}

{{ "There was an error submitting this form"|t }}

{% if form.errors|length %}
    {% for error in form.errors %}
  • {{ error }}
  • {% endfor %}
{% endif %}
{% endif %} {# -- button -- #}
{% include '_atoms/button/_template.html' with { opt: { text: "Submit Formular" | t, type: 'submit', modifiers: ['stylePrimary'] } } only %}
{{ form.renderClosingTag }}