custom/plugins/AcrisFaqCS/src/Resources/views/storefront/component/faq/acris-faq.html.twig line 1

Open in your IDE?
  1. {% block acris_faq_wrapper %}
  2.     {% set cover = faqs.media %}
  3.     {% set imagePosition = faqs.imagePosition %}
  4.     {% if imagePosition == '' %}{% set imagePosition = 'right' %}{% endif %}
  5.     {% set videoPosition = faqs.videoPosition %}
  6.     {% if videoPosition == '' %}{% set videoPosition = 'right' %}{% endif %}
  7.     {% set imageUrlType = faqs.imageUrlType %}
  8.     {% set imageUrlEntity = faqs.imageUrlEntity %}
  9.     {% set imageUrl = null %}
  10.     {% if imageUrlType is same as 'internal' and imageUrlEntity is same as 'product' %}
  11.         {% set imageUrl = seoUrl('frontend.detail.page', {'productId': faqs.imageInternalLink}) %}
  12.     {% elseif imageUrlType is same as 'internal' and imageUrlEntity is same as 'category' %}
  13.         {% set imageUrl = seoUrl('frontend.navigation.page', { navigationId: faqs.imageInternalLink }) %}
  14.     {% elseif imageUrlType is same as 'internal' and imageUrlEntity is same as 'landing_page' %}
  15.         {% set imageUrl = path('frontend.cms.page', { id: faqs.imageInternalLink }) %}
  16.     {% elseif imageUrlType is same as 'external' %}
  17.         {% if faqs.translated.imageUrl %}
  18.             {% set imageUrl = faqs.translated.imageUrl %}
  19.         {% endif %}
  20.     {% endif %}
  21.     {% set imageUrlTarget = faqs.imageUrlTarget %}
  22.     {% set videoUrl = faqs.translated.embedCode %}
  23.     {% if faqSingle %}{% set id = (faqs.id ~ '-single') %}{% else %}{% set id = faqs.id %}{% endif %}
  24.     {% set faqDocument = faqs.acrisFaqDocuments.elements %}
  25.     {% set imageSizes = {} %}
  26.     {% if faqs.imageSize == 'small' %}
  27.         {% set imageSizes = {
  28.             'default': '120px'
  29.         } %}
  30.     {% elseif faqs.imageSize == 'medium' %}
  31.         {% set imageSizes = {
  32.             'default': '280px'
  33.         } %}
  34.     {% elseif faqs.imageSize == 'large' %}
  35.         {% set imageSizes = {
  36.             'default': '400px'
  37.         } %}
  38.     {% else %}
  39.         {% set imageSizes = {
  40.             'default': '95px'
  41.         } %}
  42.     {% endif %}
  43.     {% set iconStyle = config('AcrisFaqCS.config.iconType') == null ? 'plus' : config('AcrisFaqCS.config.iconType') %}
  44.     {% set iconPosition = config('AcrisFaqCS.config.iconPosition') == null ? 'right' : config('AcrisFaqCS.config.iconPosition') %}
  45.     {% set questionBgColor = config('AcrisFaqCS.config.questionBgColor') == null ? 'primary' : config('AcrisFaqCS.config.questionBgColor') %}
  46.     {% set customTitleBgColor = config('AcrisFaqCS.config.customTitleBgColor') == null ? null : config('AcrisFaqCS.config.customTitleBgColor') %}
  47.     {% set customTitleColor = config('AcrisFaqCS.config.customTitleColor') == null ? null : config('AcrisFaqCS.config.customTitleColor') %}
  48.     {% set answerBgColor = config('AcrisFaqCS.config.answerBgColor') == null ? null : config('AcrisFaqCS.config.answerBgColor') %}
  49.     {% if customTitleBgColor is empty %}
  50.         {% set questionBgColor = 'primary' %}
  51.     {% endif %}
  52.     <style>
  53.         {% if questionBgColor is same as 'custom'  %}
  54.         .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-header {
  55.             background-color: {{ customTitleBgColor }};
  56.         }
  57.         {% endif %}
  58.         {% if customTitleColor != '' and customTitleColor is not null  %}
  59.         .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-header {
  60.             color: {{ customTitleColor }};
  61.         }
  62.         .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-header span {
  63.             color: {{ customTitleColor }};
  64.         }
  65.         {% endif %}
  66.         {% if answerBgColor != '' and answerBgColor is not null %}
  67.         .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-content .card {
  68.             background-color: {{ answerBgColor }};
  69.         }
  70.         {% endif %}
  71.     </style>
  72.     {% block acris_faq_container %}
  73.         <div class="acris-faq-accordion-wrapper" data-acris-faq="true" id="faq_group_{{ id }}" itemscope
  74.              itemprop="mainEntity" itemtype="https://schema.org/Question">
  75.             {% block acris_faq_content_question %}
  76.                 <a class="acris-faq-accordion-header {% if detailPage != true or not faqs.collapsed == 'notCollapsed' %}collapsed{% endif %} btn{% if questionBgColor is not same as 'custom' %} btn-{{ questionBgColor }}{% endif %}{% if iconPosition is same as 'left' %} question-right{% endif %}"
  77.                    href="{{ path('frontend.faq.detail', {'faqId': id}) }}"
  78.                    role="button"
  79.                    target="_blank"
  80.                    rel="noopener"
  81.                    data-toggle="collapse" data-target="#faq-{{ id }}"
  82.                     {% if faqs.collapsed == 'notCollapsed' %} aria-expanded="true" {% else %} aria-expanded="false" {% endif %}
  83.                    aria-controls="faq-{{ id }}">
  84.                     {% if iconPosition is same as 'left' %}
  85.                         {% if iconStyle is same as 'plus' %}{% sw_icon 'plus' %}{% else %}{% sw_icon 'arrow-head-down' %}{% endif %}
  86.                     {% endif %}
  87.                     <div class="acris-faq-text text-left" itemprop="name">{{ faqs.translated.name }}</div>
  88.                     {% if iconPosition is same as 'right' %}
  89.                         {% if iconStyle is same as 'plus' %}{% sw_icon 'plus' %}{% else %}{% sw_icon 'arrow-head-down' %}{% endif %}
  90.                     {% endif %}
  91.                 </a>
  92.             {% endblock %}
  93.             {% block acris_faq_content_answer %}
  94.                 <div class="acris-faq-accordion-content">
  95.                     <div class="row">
  96.                         <div class="col-12">
  97.                             <div
  98.                                 class="collapse{% if detailPage == true or faqs.collapsed == 'notCollapsed' %} show{% endif %}"
  99.                                 id="faq-{{ id }}">
  100.                                 <div
  101.                                     class="card card-body faq-wrapper-answer{% if answerBgColor is empty %} faq-wrapper-answer-background{% endif %}{% if not faqs.translated.description %} no-text {% endif %}{% if videoUrl == null %} no-video {% elseif not faqs.translated.description %} faq-video {% else %} video-position-{{ videoPosition }}{% endif %} video-wrapper {% if faqs.mediaId == null %} no-image{% else %} image-position-{{ imagePosition }}{% endif %}"
  102.                                     itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
  103.                                     {% if faqs.layout == 'cms' and faqs.cmsPageId != null %}
  104.                                         <div itemprop="text" hidden>
  105.                                             <p>{{ faqs.translated.description|raw }}</p>
  106.                                         </div>
  107.                                         {% sw_include '@Storefront/storefront/page/content/detail.html.twig' with { cmsPage: faqs.cmsPage } %}
  108.                                     {% else %}
  109.                                         {% if videoUrl %}
  110.                                             {% sw_include '@Storefront/storefront/component/faq/video/acris-faq-video.html.twig' %}
  111.                                         {% endif %}
  112.                                         {% if faqs.translated.description %}
  113.                                             {% block acris_faq_content_answer_description %}
  114.                                                 <div class="faq-text" itemprop="text">
  115.                                                     <p>{{ faqs.translated.description|raw }}</p>
  116.                                                 </div>
  117.                                             {% endblock %}
  118.                                         {% endif %}
  119.                                         {% if cover.url %}
  120.                                             {% block acris_faq_content_answer_image %}
  121.                                                 {% if cover.thumbnails.elements|length > 0 %}
  122.                                                     {% set image = cover.thumbnails|sort|first().url %}
  123.                                                 {% else %}
  124.                                                     {% set image = cover.url %}
  125.                                                 {% endif %}
  126.                                                 {% if imagePosition == 'left' or imagePosition == 'right' %}
  127.                                                     <div
  128.                                                         class="faq-image image-position-{{ imagePosition }}">
  129.                                                         <a {% if imageUrl %}href="{{ imageUrl }}" {% endif %}
  130.                                                            rel="noopener"
  131.                                                            target="{{ imageUrlTarget }}">
  132.                                                             {% sw_thumbnails 'cart-item-img-thumbnails' with {
  133.                                                                 media: cover,
  134.                                                                 sizes: imageSizes,
  135.                                                                 attributes: {
  136.                                                                     'class': 'img-fluid',
  137.                                                                     'alt': (faqs.translated.internalName ?: ''),
  138.                                                                     'title': (entity.media.translated.title ?: '')
  139.                                                                 }
  140.                                                             } %}
  141.                                                         </a>
  142.                                                     </div>
  143.                                                 {% else %}
  144.                                                     <div class="faq-image-{{ imagePosition }}">
  145.                                                         <a href="{{ imageUrl }}"
  146.                                                            rel="noopener"
  147.                                                            target="{{ imageUrlTarget }}">
  148.                                                             {% sw_thumbnails 'cart-item-img-thumbnails' with {
  149.                                                                 media: cover,
  150.                                                                 sizes: imageSizes,
  151.                                                                 attributes: {
  152.                                                                     'class': 'img-fluid',
  153.                                                                     'alt': (faqs.translated.internalName ?: ''),
  154.                                                                     'title': (entity.media.translated.title ?: '')
  155.                                                                 }
  156.                                                             } %}
  157.                                                         </a>
  158.                                                     </div>
  159.                                                 {% endif %}
  160.                                             {% endblock %}
  161.                                         {% endif %}
  162.                                         {% if faqDocument|length > 0 %}
  163.                                             {% block acris_faq_content_answer_document %}
  164.                                                 <div class="faq-document">
  165.                                                     <div class="h5">{{ 'acris-faq.detail.documentTitle'|trans }}</div>
  166.                                                     <ul>
  167.                                                         {% for item in faqDocument %}
  168.                                                             <li><a download
  169.                                                                    target="_blank"
  170.                                                                    rel="noopener"
  171.                                                                    href="{{ item.media.url }}"
  172.                                                                 >{% if item.translated.title %}{{ item.translated.title }}{% else %}{{ item.media.fileName }}.{{ item.media.fileExtension }}{% endif %}</a>
  173.                                                                 {% if item.translated.description %} - {{ item.translated.description }}{% endif %}
  174.                                                             </li>
  175.                                                         {% endfor %}
  176.                                                     </ul>
  177.                                                 </div>
  178.                                             {% endblock %}
  179.                                         {% endif %}
  180.                                     {% endif %}
  181.                                 </div>
  182.                             </div>
  183.                         </div>
  184.                     </div>
  185.                 </div>
  186.             {% endblock %}
  187.         </div>
  188.     {% endblock %}
  189. {% endblock %}