{% if singleton is not defined %} {% set singleton = blx.singletons.getSingletonById(singletonId) %} {% if not singleton %}{% exit 404 %}{% endif %} {% endif %} {% extends "_layouts/cp" %} {% set crumbs = [ { label: "Settings"|t, url: url('content') }, { label: "Singletons"|t, url: url('content/singletons') } ] %} {% set title = singleton.name %} {% set tabs = [] %} {% for tab in singleton.getFieldLayout().getTabs() %} {% set hasErrors = false %} {% for field in tab.getFields() %} {% if singleton.getErrors(field.getField().handle) %} {% set hasErrors = true %} {% endif %} {% endfor %} {% set tabs = tabs|merge([{ label: tab.name, url: '#tab'~loop.index, class: (hasErrors ? 'error' : null) }]) %} {% endfor %} {% set content %} {% if singleton.fieldLayout %}
{% else %}{{ "This singleton doesn’t have any fields yet."|t }}
{% endif %} {% endset %}