Input

<div class="form-element form-element-type-text form-group">
    <div class="input">
        <label for="input626">
            Name: * </label>

        <input class="form-control" id="input626" name="name" placeholder="Placeholder" required="true" type="text" />

    </div>
</div>
{% set CType = 'input' %}

{% set uid = random(999) %}
{% set type = type|default('text') %}

{% set attributes = [] %}

{% if name %}
    {% set attributes = attributes|merge([' name="' ~ name ~ '"']) %}
{% endif %}

{% if pattern %}
    {% set attributes = attributes|merge([' pattern="' ~ pattern ~ '"']) %}
{% endif %}

{% if placeholder %}
    {% set attributes =
        attributes|merge([' placeholder="' ~ placeholder ~ '"'])
    %}
{% endif %}

{% if required %}
    {% set attributes = attributes|merge([' required="' ~ required ~ '"']) %}
{% endif %}

{% if type and not textarea %}
    {% set attributes = attributes|merge([' type="' ~ type ~ '"']) %}
{% endif %}

{% if additionalAttributes %}
    {% for attribute in additionalAttributes %}
        {% for key, value in attribute %}
            {% set attributes =
                attributes|merge([' ' ~ key ~ '="' ~ value ~ '"'])
            %}
        {% endfor %}
    {% endfor %}
{% endif %}

{% set formElementType = textarea ? 'textarea' : 'text' %}

{% block main %}
    <div class="form-element form-element-type-{{
        formElementType
        }} form-group">
        <div class="input">
            {% if label %}
                <label for="input{{ uid }}">
                    {{ label }}{% if required %} *{% endif %}
                </label>
            {% endif %}

            {% if textarea %}
                <textarea class="form-control"
                    id="input{{ uid }}"
                    {{ attributes|join }}></textarea>
            {% else %}
                <input class="form-control"
                    id="input{{ uid }}"
                    {{ attributes|join }} />
            {% endif %}

            {# <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> #}
        </div>
    </div>
{% endblock %}
{
  "label": "Name:",
  "name": "name",
  "pattern": null,
  "placeholder": "Placeholder",
  "required": true,
  "textarea": null,
  "type": null,
  "additionalAttributes": null
}

No notes defined.