{% import "_includes/forms" as forms %} {% macro blockList(blocks, selected, namePrefix) %} {% from "_includes/forms" import checkbox %} {% for block in blocks %} {% set label -%} {{ block.name|t }} {%- if block.required %} {% endif %} {%- endset %}
{{ checkbox({ label: label, name: namePrefix ~ '[]', value: block.id, checked: (block.required or block.id in selected), disabled: block.required }) }}
{% endfor %} {% endmacro %} {% if blx.hasPackage('PublishPro') %} {% set sections = blx.sections.indexBy('id').find %} {{ forms.selectField({ label: "Section"|t, instructions: "Which section do you want to publish entries to?"|t, id: 'section', name: 'section', options: sections, value: settings.section, toggle: true, targetPrefix: 'section' }) }} {% set blocksInput %} {% for section in sections %} {% set show = ((not settings.section and loop.first) or settings.section == section.id) %} {% endfor %} {% endset %} {% else %} {% set blocksInput %} {% set blocks = blx.entryBlocks.getAllBlocks %} {{ _self.blockList(blocks, settings.blocks) }} {% endset %} {% endif %} {{ forms.field({ label: "Entry Blocks"|t, instructions: "Which entry blocks should be visible in the widget?"|t }, blocksInput) }}