{% requireAdmin %} {% extends "_layouts/cp" %} {% set title = "Fields"|t('app') %} {% do view.registerAssetBundle("craft\\web\\assets\\fields\\FieldsAsset") %} {% do view.registerTranslations('app', [ "What do you want to name the group?", "Could not create the group:", "Could not create the group:", "Are you sure you want to delete this group and all its fields?", "Could not delete the group.", "Group renamed.", ]) %} {% set crumbs = [ { label: "Settings"|t('app'), url: url('settings') } ] %} {% set groups = craft.app.fields.getAllGroups()|index('id') %} {% if groupId is defined %} {% if groups[groupId] is not defined %} {% exit 404 %} {% endif %} {% set fields = groups[groupId].getFields() %} {% else %} {% set fields = craft.app.fields.getAllFields() %} {% endif %} {% block actionButton %} {% if groups %} {% set newFieldUrl = url('settings/fields/new', (groupId is defined ? { groupId: groupId } : null)) %} {{ "New field"|t('app') }} {% endif %} {% endblock %} {% block sidebar %}
{% endblock %} {% block content %}{% if groupId is defined %} {{ "This group doesn’t have any fields yet."|t('app') }} {% else %} {{ "No fields exist yet."|t('app') }} {% endif %}
{% if fields %}{{ "Name"|t('app') }} | {{ "Handle"|t('app') }} | {{ "Type"|t('app') }} | {% if groupId is not defined %}{{ "Group"|t('app') }} | {% endif %}{% for field in fields %} |
---|---|---|---|---|
{{ field.name|t('site') }} {%- if field.required %} {% endif -%} | {{ field.handle }} |
{% if field is missing %} {{ field.expectedType }} {% else %} {{ field.displayName() }} {% endif %} | {% if groupId is not defined %}{{ field.group.name|t('site') }} | {% endif %}