templates/areas/faq-brick/view.html.twig line 1

Open in your IDE?
  1. {% set withContact = showContact | default('true') == 'true' %}
  2. {% set container = containerSize | default('container') %}
  3. {# Defined as EditableDialogBoxInterface field #}
  4. {% set faqObjects = faqObjects ?? pimcore_relations('frequently-asked-questions').getElements() %}
  5. {% embed 'app/area-brick-layout.html.twig' %}
  6.     {% block content %}
  7.         {% if editmode and faqObjects is empty %}
  8.             <div class="container text-center text-red">
  9.                 <h2>Nog geen vragen gekoppeld, dit brick is momenteel niet zichtbaar.</h2>
  10.             </div>
  11.         {% elseif faqObjects is not empty %}
  12.             <section class="delay-200">
  13.             <div class="{{ container }} {{ containerClass | default() }} flex flex-wrap py-10 md:py-20">
  14.                 <div class="w-full {% if withContact %} md:w-1/2 {% endif %}">
  15.                     {% if showAutoNotice ?? true %}
  16.                         {% include 'areas/faq-brick/partials/editmode/_no-objects-found.html.twig' %}
  17.                     {% endif %}
  18.                     {% if faqObjects is not empty %}
  19.                         <h2 class="mb-4 text-2xl md:mb-10 mb:text-3xl">{{ "Veelgestelde vragen"|trans }}</h2>
  20.                         {% for faq in faqObjects %}
  21.                             <div class="px-4 mb-2 bg-white rounded-md shadow md:px-6 md:mb-3" x-data="{ open: false }">
  22.                                 <div
  23.                                     class="flex items-center justify-between py-6 cursor-pointer"
  24.                                     @click="open = !open"
  25.                                 >
  26.                                     <h3 class="mb-0 text-lg leading-tight">{{ faq.question }}</h3>
  27.                                     <span
  28.                                         class="flex items-center justify-center w-8 h-8 transition-all duration-500 bg-blue-200 rounded-full shrink-0"
  29.                                         :class="{ 'rotate-180' : !open }"
  30.                                     >
  31.                                         <svg class="w-4 h-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 10">
  32.                                             <path fill="#0072BB" fill-rule="evenodd" d="M.39 7.64 7.12.676c.24-.248.575-.388.926-.388.35 0 .685.14.925.388l6.732 6.964a1.206 1.206 0 0 1-.068 1.748l-.114.09a1.297 1.297 0 0 1-1.669-.154L8.045 3.316 2.239 9.323a1.295 1.295 0 0 1-1.783.065A1.205 1.205 0 0 1 .389 7.64H.39Z"/>
  33.                                         </svg>
  34.                                     </span>
  35.                                 </div>
  36.                                 <div class="block overflow-hidden transition-all duration-700 max-h-0"
  37.                                     :style="open ? `max-height:  ${ $el.scrollHeight + 24 }px` : ``"
  38.                                     :class="{ 'pb-6' : open }"
  39.                                 >
  40.                                     <p>{{ faq.answer|raw }}</p>
  41.                                 </div>
  42.                             </div>
  43.                         {% endfor %}
  44.                     {% endif %}
  45.                 </div>
  46.                 {% if withContact == 'true' %}
  47.                 <div class="flex flex-col w-full mt-8 md:flex-row md:mt-0 md:w-1/2 lg:pl-36">
  48.                     {% include 'includes/partials/_contact-snippet.html.twig' %}
  49.                 </div>
  50.                 {% endif %}
  51.             </div>
  52.         </section>
  53.         {% endif %}
  54.     {% endblock %}
  55. {% endembed %}
  56. {% if faqObjects is not empty %}
  57.   <script type="application/ld+json">
  58.     {
  59.       "@context": "https://schema.org",
  60.       "@type": "FAQPage",
  61.       "mainEntity": [
  62.         {% for faq in faqObjects %}
  63.           {
  64.             "@type": "Question",
  65.             "name": "{{ faq.question }}",
  66.             "acceptedAnswer": {
  67.               "@type": "Answer",
  68.               "text": "{{ faq.answer | raw | escape }}"
  69.             }
  70.           }{% if not loop.last %},{% endif %}
  71.         {% endfor %}
  72.       ]
  73.     }
  74.   </script> 
  75. {% endif %}