{% from "_includes/forms" import field %} {% if entity is not defined %}{% set entity = null %}{% endif %} {% set value = (entity ? attribute(entity, block.handle) : null) %} {% set errors = (entity ? entity.getErrors(block.handle) : null) %} {% set blockType = blx.blockTypes.populateBlockType(block, entity) %} {% if blockType %} {% set input = blockType.getInputHtml(block.handle, value) %} {% else %} {% set input = '
' ~ "The blocktype class “{class}” could not be found."|t({ class: block.type }) ~ '
' %} {% endif %} {{ field({ label: block.name, required: block.required, translatable: block.translatable, instructions: block.instructions, id: block.handle, errors: errors }, input)|ns('blocks')|raw }}