templates/component/form/form.html.twig line 1

Open in your IDE?
  1. {#
  2.       component: form
  3.     action {string}: Action du formulaire
  4.     inputs {array}: tableau d'inputs
  5.     buttonText {string}: Texte du bouton d'envoi
  6.     information {string}: Texte d'information
  7.     mandatory {string}: Texte de champs obligatoires
  8. #}
  9. {% set props = {
  10.   action: '',
  11.   inputs:null,
  12.   buttonText:null,
  13.   information:null,
  14.   mandatory:null
  15. }|merge(props|default({}))  %}
  16. <div data-component="form" class="Form-component">
  17.     <form action="{{ props.action }}" autocomplete="false" class="ContactForm-form" method="POST">
  18.         {% for message in app.flashes('success') %}
  19.             <div class="form-message success" role="alert">
  20.                 {{ message }}
  21.             </div><br>
  22.         {% endfor %}
  23.         {% for message in app.flashes('error') %}
  24.             <div class="form-message error" role="alert">
  25.                 {{ message }}
  26.             </div><br>
  27.         {% endfor %}
  28.         <br>
  29.         {# Inputs #}
  30.         <div class="ContactForm-inputs">
  31.             {% for item in props.inputs %}
  32.                 <div class="ContactForm-input {% if item.class is defined and item.class is not null %}{{ item.class }}{% endif %}">
  33.                     {% include "component/form/input.html.twig" with {
  34.                             props: item
  35.                     } %}
  36.                 </div>
  37.             {% endfor %}
  38.             <input type="hidden" class="g-recaptcha-response" name="g-recaptcha-response"/>
  39.         </div>
  40.         {# Submit button #}
  41.         <div class="ContactForm-submit">
  42.             {% include "component/form/submit.html.twig" with {
  43.                 props: {
  44.                     text: props.buttonText,
  45.                     contactButton:true
  46.                 }
  47.             } %}
  48.         </div>
  49.         {# Infos #}
  50.         {% if props.information is defined and props.information is not null %}
  51.             <p class="ContactForm-info">{{ props.information|raw }}</p>
  52.         {% endif %}
  53.         {# Mandatory fields info #}
  54.         {% if props.mandatory is defined and props.mandatory is not null %}
  55.             <p class="ContactForm-mandatoryFieldsInfo">{{ props.mandatory }}</p>
  56.         {% endif %}
  57.     </form>
  58. </div>