{{ hiddenInput(name, '') }}
{% set totalNewBlocks = 0 %} {% for block in blocks %} {% set blockId = block.id %} {% set blockIsNew = blockId is empty %} {% if blockIsNew %} {% set totalNewBlocks = totalNewBlocks + 1 %} {% set blockId = 'new'~totalNewBlocks %} {% endif %} {% set baseInputName = "#{name}[blocks][#{blockId}]" %} {% set blockAttributes = { class: [ 'matrixblock', not block.enabled ? 'disabled', static ? 'static', ]|filter, data: { id: blockId, type: block.getType().handle, collapsed: block.collapsed, }, } %} {% set actionBtnLabel = "#{block.getType().name} #{'Actions'|t('app')}" %} {% set actionMenuId = "matrixblock-action-menu-#{blockId}" %} {% set actionBtnAttributes = { class: ['btn', 'settings', 'icon', 'menubtn'], type: 'button', role: 'button', title: 'Actions'|t('app'), aria: { controls: actionMenuId, label: actionBtnLabel, }, data: { 'disclosure-trigger': true, } } %}
{% if not static %} {{ hiddenInput("#{name}[sortOrder][]", blockId) }} {# only register a delta name for this block if it's not new #} {% if not blockIsNew %} {% do view.registerDeltaName(baseInputName) %} {% endif %} {{ hiddenInput("#{baseInputName}[type]", block.getType().handle) }} {{ hiddenInput("#{baseInputName}[enabled]", block.enabled ? '1' : '') }}
{{ block.getType().name|t('site') }} {% if block.hasErrors() %}{% endif %}
{{ tag('span', { class: 'visually-hidden', html: 'Disabled'|t('app'), }) }}
{% endif %}
{% namespace baseInputName %} {{ block.getFieldLayout().createForm(block, static).render()|raw }} {% endnamespace %}
{% endfor %}
{% if not static and not staticBlocks %}
{% for blockType in blockTypes %} {% endfor %}
{% endif %}