{% 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}]" %}
{# only register a delta name for this black if it's not new #}
{% if not blockIsNew %}
{% do view.registerDeltaName(baseInputName) %}
{% endif %}
{{ hiddenInput("#{name}[sortOrder][]", blockId) }}
{{ hiddenInput("#{baseInputName}[type]", block.getType().id) }}
{% if not staticField %}
{% endif %}
{% include "super-table/matrix/fields" with {
namespace: "#{baseInputName}[fields]",
element: block,
fields: block.getType().getFieldLayout().getFields(),
settings: supertableField,
registerDeltas: not blockIsNew,
} %}