{% import "_includes/forms" as forms %} {% includeCssResource 'supertable/css/SuperTableConfigurator.css' %} {% set blockTypeInput %}
{{ "Fields" | t }}
{% for blockType in settings.getBlockTypes() %}
{% for field in blockType.getFields() %}
{% if field.name %} {{ field.name }} {% else %} {{ '(blank)' | t }} {% endif %}
{% if field.handle %} {{ field.handle }} {% else %}   {% endif %}
{% endfor %}
{% endfor %}
{{ "New field" | t }}
{{ "Field Settings" | t }}
{% for blockType in settings.getBlockTypes() %}
{% for field in blockType.getFields() %} {% set fieldId = field.id %} {% set fieldName = 'blockTypes[' ~ blockType.id ~ '][fields][' ~ fieldId ~ ']' %} {# Additional field settings #} {% if settings.columns is defined %} {% if settings.columns[fieldId] is defined %} {% set width = (settings.columns[fieldId].width is defined) ? settings.columns[fieldId].width : '' %} {% set required = (settings.columns[fieldId].required is defined) ? settings.columns[fieldId].required : '' %} {% endif %} {% endif %}
{{ forms.textField({ label: "Name" | t, instructions: "What this field will be called in the CP." | t, id: fieldId ~ '-name', name: fieldName ~ '[name]', value: (field.name != '__blank__' ? field.name), errors: field.getErrors('name'), required: true, autofocus: true, }) }} {{ forms.textField({ label: "Handle" | t, instructions: "How you’ll refer to this field in the templates." | t, id: fieldId ~ '-handle', class: 'code', name: fieldName ~ '[handle]', maxlength: 64, value: field.handle, errors: field.getErrors('handle'), required: true, }) }} {{ forms.textareaField({ label: "Instructions" | t, instructions: "Helper text to guide the author. Will appear as a small `info` icon in table headers." | t, id: fieldId ~ '-instructions', class: 'nicetext', name: fieldName ~ '[instructions]', value: field.instructions, errors: field.getErrors('instructions'), }) }} {{ forms.textField({ label: "Column Width" | t, instructions: "Only applies for Table Layout. Set the width for this column in either pixels or percentage. i.e. `10px` or `10%`." | t, id: fieldId ~ '-width', name: fieldName ~ '[width]', size: 8, value: width | default(''), }) }} {{ forms.checkboxField({ label: "This field is required" | t, name: fieldName ~ '[required]', checked: field.required }) }} {% if craft.isLocalized() %} {{ forms.checkboxField({ label: "This field is translatable" | t, name: fieldName ~ '[translatable]', checked: field.translatable }) }} {% endif %}
{% set fieldType = field.getFieldType() %} {% set isFieldTypeMissing = not fieldType %} {% if isFieldTypeMissing %} {% set fieldType = craft.fields.getFieldType('PlainText') %} {% endif %} {{ forms.selectField({ label: "Field Type" | t, warning: (not field.isNew() ? "Changing this may result in data loss." | t), id: fieldId~'-type', name: fieldName ~ '[type]', options: fieldTypes, value: fieldType.getClassHandle(), errors: (isFieldTypeMissing ? ["The fieldtype class “{class}” could not be found." | t({ class: field.type })] : null), }) }}
{% namespace fieldName ~ '[typesettings]' %} {# Special-case for Matrix at the moment - hopefully will not be needed after core alts #} {# This is necessary to load our MatrixConfiguratorAlt.js rather than core Matrix JS #} {% if fieldType.getClassHandle() == 'Matrix' %} {{ craft.superTable.getMatrixSettingsHtml(fieldType) | raw }} {% else %} {{ fieldType.getSettingsHtml() | raw }} {% endif %} {% endnamespace %}

{{ "Delete" | t }}
{% endfor %}
{% endfor %}
{% endset %} {{ forms.selectField({ label: "Field Layout" | t, instructions: "Set how fields are presented. Table Layout displays fields vertically in a table, while Row Layout displays fields horizontally." | t, id: 'fieldLayout', name: 'fieldLayout', options: {table: 'Table Layout', row: "Row Layout"}, value: settings.fieldLayout, }) }}
{{ forms.field({ label: "Configuration" | t, instructions: "Define the fields your Super Table should have." | t, name: 'config' }, blockTypeInput) }}
{{ forms.textField({ label: "New Row Label" | t, instructions: "Enter the text you want to appear in the button to create a new row." | t, id: 'selectionLabel', name: 'selectionLabel', value: settings.selectionLabel, size: 25, errors: settings.getErrors('selectionLabel') }) }} {{ forms.textField({ label: "Min Rows" | t, instructions: "The minimum number of rows the field must to have." | t, id: 'minRows', name: 'minRows', value: settings.minRows, size: 3, errors: settings.getErrors('minRows') }) }} {{ forms.textField({ label: "Max Rows" | t, instructions: "The maximum number of rows the field is allowed to have." | t, id: 'maxRows', name: 'maxRows', value: settings.maxRows, size: 3, errors: settings.getErrors('maxRows') }) }} {{ forms.lightswitchField({ label: "Static field" | t, instructions: "A static field will only display a single row of fields." | t, id: 'staticField', name: 'staticField', on: settings.staticField, }) }}