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. {% set titleBorderColor = config('AcrisFaqCS.config.titleBorderColor') == null ? null : config('AcrisFaqCS.config.titleBorderColor') %}
  50. {% if customTitleBgColor is empty %}
  51. {% set questionBgColor = 'primary' %}
  52. {% endif %}
  53. {% set htmlHeadlineTag = 'div' %}
  54. {% if detailPage %}
  55. {% set htmlHeadlineTag = 'h1' %}
  56. {% endif %}
  57. <style>
  58. {% if questionBgColor is same as 'custom' %}
  59. .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-header {
  60. background-color: {{ customTitleBgColor }};
  61. }
  62. {% endif %}
  63. {% if customTitleColor != '' and customTitleColor is not null %}
  64. .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-header {
  65. color: {{ customTitleColor }};
  66. }
  67. .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-header span {
  68. color: {{ customTitleColor }};
  69. }
  70. {% endif %}
  71. {% if answerBgColor != '' and answerBgColor is not null %}
  72. .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-content .card {
  73. background-color: {{ answerBgColor }};
  74. }
  75. {% endif %}
  76. .title-font-color{
  77. color: {{ customTitleColor }} !important;
  78. }
  79. {% if titleBorderColor %}
  80. .acris-faq-accordion-wrapper#faq_group_{{ id }} .acris-faq-accordion-content.show-border {
  81. border-color: {{ titleBorderColor }};
  82. }
  83. {% endif %}
  84. </style>
  85. {% block acris_faq_container %}
  86. <div class="acris-faq-accordion-wrapper" data-acris-faq="true" id="faq_group_{{ id }}" itemscope
  87. itemprop="mainEntity" itemtype="https://schema.org/Question">
  88. {% block acris_faq_content_question %}
  89. <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 %} icon-style-{{ iconStyle|lower }}{% if config('AcrisFaqCS.config.titlePadding') == "noPadding" %} p-0{% endif %}"
  90. href="{{ path('frontend.faq.detail', {'faqId': id}) }}"
  91. role="button"
  92. target="_blank"
  93. rel="noopener"
  94. data-toggle="collapse" data-target="#faq-{{ id }}"
  95. {% if faqs.collapsed == 'notCollapsed' %} aria-expanded="true" {% else %} aria-expanded="false" {% endif %}
  96. aria-controls="faq-{{ id }}">
  97. {% if iconPosition is same as 'left' %}
  98. {% if iconStyle is same as 'plus' %}{% sw_icon 'plus' %}{% elseif iconStyle is same as 'arrow' %}{% sw_icon 'arrow-head-down' %}{% else %}<span class="icon-plus-minus"></span>{% endif %}
  99. {% endif %}
  100. <{{ htmlHeadlineTag }} class="acris-faq-text text-left{% if detailPage %} title-font-color{% endif %}" itemprop="name">{{ faqs.translated.name }}</{{ htmlHeadlineTag }}>
  101. {% if iconPosition is same as 'right' %}
  102. {% if iconStyle is same as 'plus' %}{% sw_icon 'plus' %}{% elseif iconStyle is same as 'arrow' %}{% sw_icon 'arrow-head-down' %}{% else %}<span class="icon-plus-minus"></span>{% endif %}
  103. {% endif %}
  104. </a>
  105. {% endblock %}
  106. {% block acris_faq_content_answer %}
  107. <div class="acris-faq-accordion-content{% if config('AcrisFaqCS.config.titleBorder') == "showBorder" %} show-border{% endif %}">
  108. <div class="row">
  109. <div class="col-12">
  110. <div
  111. class="collapse{% if detailPage == true or faqs.collapsed == 'notCollapsed' %} show{% endif %}"
  112. id="faq-{{ id }}">
  113. <div
  114. 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 %}{% if config('AcrisFaqCS.config.contentPadding') == "noPadding" %} p-0{% endif %}"
  115. itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
  116. {% if faqs.layout == 'cms' and faqs.cmsPageId != null %}
  117. <div itemprop="text" hidden>
  118. <p>{{ faqs.translated.description|raw }}</p>
  119. </div>
  120. {% sw_include '@Storefront/storefront/page/content/detail.html.twig' with { cmsPage: faqs.cmsPage } %}
  121. {% else %}
  122. {% if videoUrl %}
  123. {% sw_include '@Storefront/storefront/component/faq/video/acris-faq-video.html.twig' %}
  124. {% endif %}
  125. {% if faqs.translated.description %}
  126. {% block acris_faq_content_answer_description %}
  127. <div class="faq-text" itemprop="text">
  128. <p>{{ faqs.translated.description|raw }}</p>
  129. </div>
  130. {% endblock %}
  131. {% endif %}
  132. {% if cover.url %}
  133. {% block acris_faq_content_answer_image %}
  134. {% if cover.thumbnails.elements|length > 0 %}
  135. {% set image = cover.thumbnails|sort|first().url %}
  136. {% else %}
  137. {% set image = cover.url %}
  138. {% endif %}
  139. {% if imagePosition == 'left' or imagePosition == 'right' %}
  140. <div
  141. class="faq-image image-position-{{ imagePosition }}">
  142. <a {% if imageUrl %}href="{{ imageUrl }}" {% endif %}
  143. rel="noopener"
  144. target="{{ imageUrlTarget }}">
  145. {% sw_thumbnails 'cart-item-img-thumbnails' with {
  146. media: cover,
  147. sizes: imageSizes,
  148. attributes: {
  149. 'class': 'img-fluid',
  150. 'alt': (faqs.translated.internalName ?: ''),
  151. 'title': (entity.media.translated.title ?: '')
  152. }
  153. } %}
  154. </a>
  155. </div>
  156. {% else %}
  157. <div class="faq-image-{{ imagePosition }}">
  158. <a href="{{ imageUrl }}"
  159. rel="noopener"
  160. target="{{ imageUrlTarget }}">
  161. {% sw_thumbnails 'cart-item-img-thumbnails' with {
  162. media: cover,
  163. sizes: imageSizes,
  164. attributes: {
  165. 'class': 'img-fluid',
  166. 'alt': (faqs.translated.internalName ?: ''),
  167. 'title': (entity.media.translated.title ?: '')
  168. }
  169. } %}
  170. </a>
  171. </div>
  172. {% endif %}
  173. {% endblock %}
  174. {% endif %}
  175. {% if faqDocument|length > 0 %}
  176. {% block acris_faq_content_answer_document %}
  177. <div class="faq-document">
  178. <div class="h5">{{ 'acris-faq.detail.documentTitle'|trans }}</div>
  179. <ul>
  180. {% for item in faqDocument %}
  181. <li><a download
  182. target="_blank"
  183. rel="noopener"
  184. href="{{ item.media.url }}"
  185. >{% if item.translated.title %}{{ item.translated.title }}{% else %}{{ item.media.fileName }}.{{ item.media.fileExtension }}{% endif %}</a>
  186. {% if item.translated.description %} - {{ item.translated.description }}{% endif %}
  187. </li>
  188. {% endfor %}
  189. </ul>
  190. </div>
  191. {% endblock %}
  192. {% endif %}
  193. {% endif %}
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. {% endblock %}
  200. </div>
  201. {% endblock %}
  202. {% endblock %}