{% import "_includes/forms" as forms %} {% if block %} {% set blockType = blx.blockTypes.populateBlockType(block) %} {% set isBlockTypeMissing = not blockType %} {% else %} {% set isBlockTypeMissing = false %} {% endif %} {% if blockType is not defined or isBlockTypeMissing %} {% set blockType = blx.blockTypes.getBlockType('PlainText') %} {% endif %} {{ forms.textField({ label: "Name"|t, instructions: "What this block will be called in the CP."|t, id: 'name', name: 'name', value: (block ? block.name : null), errors: (block ? block.getErrors('name') : null), autofocus: true, required: true, translatable: true }) }} {{ forms.textField({ label: "Handle"|t, instructions: "How you’ll refer to this block in the templates."|t, id: 'handle', class: 'code', name: 'handle', value: (block ? block.handle : null), errors: (block ? block.getErrors('handle') : null), required: true, }) }} {{ forms.textareaField({ label: "Instructions"|t, instructions: "Helper text to guide the author."|t, name: 'instructions', value: (block ? block.instructions : null), errors: (block ? block.getErrors('instructions') : null), translatable: true }) }} {{ forms.checkboxField({ label: "This block is required"|t, name: 'required', checked: (block ? block.required : false) }) }} {% if blx.hasPackage('Language') and canBeTranslatable is defined and canBeTranslatable %} {{ forms.checkboxField({ label: "This block is translatable"|t, name: 'translatable', checked: (block ? block.translatable : false) }) }} {% endif %} {% set blockTypes = blx.blockTypes.getAllBlockTypes %} {{ forms.selectField({ label: "Type", instructions: "What type of block is this?"|t, id: 'type', name: 'type', options: blockTypes, value: blockType.classHandle, errors: (isBlockTypeMissing ? ["The blocktype class “{class}” could not be found."|t({ class: block.type })] : null), toggle: true }) }} {% for _blockType in blockTypes %} {% set isCurrent = (_blockType.classHandle == blockType.classHandle) %} {% if isCurrent %} {% set settings = blockType.settingsHtml %} {% else %} {% set settings = _blockType.settingsHtml %} {% endif %} {% if settings %}