{% import "_includes/forms" as forms %}


{{ forms.textField({
    label: "Placeholder Text"|t('app'),
    instructions: "The text that will be shown if the field doesn’t have a value."|t('app'),
    id: 'placeholder',
    name: 'placeholder',
    value: field.placeholder,
    errors: field.getErrors('placeholder')
}) }}

{{ forms.textField({
    label: "Character Limit"|t('app'),
    instructions: "The maximum number of characters the field is allowed to have."|t('app'),
    id: 'char-limit',
    name: 'charLimit',
    value: field.charLimit,
    size: 3,
    errors: field.getErrors('charLimit')
}) }}

{{ forms.checkboxField({
    label: "Use a monospaced font"|t('app'),
    name: 'code',
    checked: field.code,
}) }}

{{ forms.checkboxField({
    label: "Allow line breaks"|t('app'),
    name: 'multiline',
    checked: field.multiline,
    toggle: 'initialRowsContainer'
}) }}


<div id="initialRowsContainer" class="nested-fields{% if not field.multiline %} hidden{% endif %}">
    {{ forms.textField({
        label: "Initial Rows"|t('app'),
        id: 'initialRows',
        name: 'initialRows',
        value: field.initialRows,
        size: 3,
        errors: field.getErrors('initialRows')
    }) }}
</div>

{% if craft.app.db.isMysql %}
    <hr>
    <a class="fieldtoggle" data-target="advanced">{{ "Advanced"|t('app') }}</a>
    <div id="advanced" class="hidden">
        {{ forms.selectField({
            label: "Column Type"|t('app'),
            id: 'column-type',
            name: 'columnType',
            instructions: "The type of column this field should get in the database."|t('app'),
            options: [
                { value: 'string', label: 'varchar (255B)' },
                { value: 'text', label: 'text (~64KB)' },
                { value: 'mediumtext', label: 'mediumtext (~16MB)' },
            ],
            value: field.columnType,
            warning: (field.id ? "Changing this may result in data loss."|t('app')),
        }) }}
    </div>
{% endif %}
