templates/Blocks/Form/Frontend/renderFrontend.html.twig line 1

Open in your IDE?
  1. {% if data.fields is not empty %}
  2.     <input type="hidden" name="forms[{{ block.identifier }}][name]" value="My Form"/>
  3.     <input type="hidden" name="forms[{{ block.identifier }}][email_template]" value="{{ data.email_template }}"/>
  4.     <section class="block block-form">
  5.         {% for fieldKey,someField in data.fields %}
  6.             <input type="hidden" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][label]" value="{{ someField.label }}"/>
  7.             <input type="hidden" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][type]" value="{{ someField.type }}"/>
  8.             <div class="form-group">
  9.                 <label>{{ someField.label }}</label>
  10.                 {% if someField.type == "text" %}
  11.                     <input type="text" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]" class="form-control"/>
  12.                 {% elseif someField.type == "email" %}
  13.                     <input type="email" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]" class="form-control"/>
  14.                 {% elseif someField.type == "textarea" %}
  15.                     <textarea class="form-control" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]"></textarea>
  16.                 {% elseif someField.type == "select" %}
  17.                     <select class="form-control" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value]">
  18.                         <option value="">---</option>
  19.                         {% for someOption in someField.options|split("\n") %}
  20.                             <option value="{{ someOption }}">{{ someOption }}</option>
  21.                         {% endfor %}
  22.                     </select>
  23.                 {% elseif someField.type == "checkbox" %}
  24.                     {% for someOption in someField.options|split("\n") %}
  25.                         <div class="form-check">
  26.                             <input class="form-check-input" type="checkbox" name="forms[{{ block.identifier }}][fields][{{ fieldKey }}][value][]" value="{{ someOption|trim }}">
  27.                             <label class="form-check-label">{{ someOption }}</label>
  28.                         </div>
  29.                     {% endfor %}
  30.                 {% endif %}
  31.             </div>
  32.         {% endfor %}
  33.         <div class="row">
  34.             <div class="col-sm-12">
  35.                 <div class="form-check">
  36.                     <button class="btn btn-primary float-right" name="action" value="submit_form" data-action="handle-recaptcha-form">Submit</button>
  37.                 </div>
  38.             </div>
  39.         </div>
  40.     </section>
  41. {% endif %}