{% extends 'forms/' ~ layout|default('field') ~ '.html.twig' %}

{% set value = value ?: (scope ~ name)|split('.')|slice(-2, -1)|first %}

{% block input %}
    <input  type="text"
            class="{{ field.classes|join(' ') }}"
            name="{{ (scope ~ name)|fieldName }}"
            value="{{ value }}"
            {% if field.placeholder %}placeholder="{{ field.placeholder }}"{% endif %}
            {% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
            {% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
            {% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
            {% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
            {% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
            {% if field.validate.pattern %}pattern="{{ field.validate.pattern }}"{% endif %}

    />
{% endblock %}
