templates/segments/newsletter.html.twig line 1

Open in your IDE?
  1. {%  if editmode %}
  2.     {% do pimcore_head_link().appendStylesheet(asset('static/css/index.css')) %}
  3.     {{ pimcore_head_link() }}
  4. {% endif %}
  5. {% if not isMobile|default() %}
  6.     <script src="https://www.google.com/recaptcha/api.js?render={{ google_captcha_v3_site_key }}"></script>
  7.     <script>
  8.         function getReCaptcha() {
  9.             grecaptcha.ready(function() {
  10.                 document.querySelectorAll('.newsletter-input-wrapper').forEach(function(wrapper) {
  11.                     wrapper.addEventListener("submit", function(event) {
  12.                         event.preventDefault();
  13.                         grecaptcha.execute('{{ google_captcha_v3_site_key }}', { action: 'submit' }).then(function(token) {
  14.                             wrapper.querySelectorAll(".newsletter-g-recaptcha-response").forEach(function(elem, index) {
  15.                                 elem.value = token;
  16.                             })
  17.                         });
  18.                     });
  19.                     grecaptcha.execute('{{ google_captcha_v3_site_key }}', { action: 'submit' }).then(function(token) {
  20.                         wrapper.querySelectorAll(".newsletter-g-recaptcha-response").forEach(function(elem, index) {
  21.                             elem.value = token;
  22.                         })
  23.                     });
  24.                 });
  25.             });
  26.         }
  27.         getReCaptcha();
  28.     </script>
  29. {% endif %}
  30. {{ form_start(form, { attr: { 'novalidate': 'novalidate', 'class': 'newsletter-input-wrapper', 'data-generic-error-message': 'newsletter.generic_email_message'|trans }}) }}
  31.     <div class="position-relative">
  32.         {{ form_widget(form.email) }}
  33.         {{ form_label(form.email, null, {'label_attr': { 'class': 'form__label', 'style': 'top: 50%; transform: translateY(-50%)' }}) }}
  34.         <div class="newsletter-input-wrapper_error-box" data-error-message='["{{ "newsletter.email.required"|trans }}", "{{ "newsletter.email.valid"|trans }}", "{{ "newsletter.email.max"|trans }}"]'>{{ form_errors(form.email) }}{% if error is defined %}{{ error }}{% endif %}</div>
  35.     
  36.         {% if fixedVersion is defined and fixedVersion %}
  37.             {{ form_widget(form.submit, {'attr': { 'class': 'btn btn-secondary' }}) }}
  38.         {% endif %}
  39.     </div>
  40.     <div class="position-relative d-flex align-items-flex-start my-2">
  41.             {{ form_widget(form.privacyConsent) }}
  42.             {{ form_label( form.privacyConsent, null, {'label_attr': { 'class': 'position-relative w-100 ml-2' }, 'label_html': true }) | raw }}
  43.         <div class="newsletter-input-wrapper_error-box form__error--checkbox checkbox-error" data-error-message="{{ "meddox.contact_us.checkbox.empty"|trans }}">{{ form_errors(form.privacyConsent) }}</div>
  44.     </div>
  45.     {% if fixedVersion is not defined or not fixedVersion %}
  46.         <div class="button-wrapper">
  47.             {{ form_widget(form.submit, {'attr': { 'class': 'btn btn-secondary' }}) }}
  48.         </div>
  49.     {% endif %}
  50.     <input type="hidden" id="newsletter-g-recaptcha-response" class="newsletter-g-recaptcha-response" name="newsletter-g-recaptcha-response">
  51. {{ form_end(form) }}