{{ 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, }, } %}
{% if not static %} {{ hiddenInput("#{name}[sortOrder][]", blockId) }} {# only register a delta name for this black 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 %}
{% endif %}
{% namespace baseInputName %} {{ block.getFieldLayout().createForm(block, static).render()|raw }} {% endnamespace %}
{% endfor %}
{% if not static and not staticBlocks %}
{% for blockType in blockTypes %} {% endfor %}
{% endif %}