{% if data.fields is not empty %}
<input type="hidden" name="forms[{{ block.identifier }}][name]" value="My Form"/>
<input type="hidden" name="forms[{{ block.identifier }}][email_template]" value="{{ data.email_template }}"/>
<section class="block block-form">
{% for fieldKey,someField in data.fields %}
<input type="hidden" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][label]" value="{{ someField.label }}"/>
<input type="hidden" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][type]" value="{{ someField.type }}"/>
<div class="form-group">
<label>{{ someField.label }}</label>
{% if someField.type == "text" %}
<input type="text" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]" class="form-control"/>
{% elseif someField.type == "email" %}
<input type="email" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]" class="form-control"/>
{% elseif someField.type == "textarea" %}
<textarea class="form-control" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]"></textarea>
{% elseif someField.type == "select" %}
<select class="form-control" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]">
<option value="">---</option>
{% for someOption in someField.options|split("\n") %}
<option value="{{ someOption }}">{{ someOption }}</option>
{% endfor %}
</select>
{% elseif someField.type == "checkbox" %}
{% for someOption in someField.options|split("\n") %}
<div class="form-check">
<input class="form-check-input" type="checkbox" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value][]" value="{{ someOption|trim }}">
<label class="form-check-label">{{ someOption }}</label>
</div>
{% endfor %}
{% endif %}
</div>
{% endfor %}
<div class="row">
<div class="col-sm-12">
<div class="form-check">
<button class="btn btn-primary float-right" name="action" value="submit_form" data-action="handle-recaptcha-form">Submit</button>
</div>
</div>
</div>
</section>
{% endif %}