templates/product/detail.html.twig line 1

Open in your IDE?
  1. {% extends "layout/default.html.twig" %}
  2. {% block content %}
  3.     {{ jld_root(product, true, true) }}
  4.     {% set brickAttributes = product.getObjectBrickAttributes() %}
  5.     {% set brand = null %}
  6.     {% if product.brand %}
  7.         {% set brand = product.brand.getTitle(app.request.locale) %}
  8.     {% endif %}
  9.     {% set detailUrl = linkGenerator(product) %}
  10.     {% set productCategory = product.category %}
  11.     {% if productCategory.getDisplayTitle(app.request.locale) != '' %}
  12.         {% set catTitle = productCategory.getDisplayTitle(app.request.locale) ~ '-' %}
  13.     {% else %}
  14.         {% set catTitle = '' %}
  15.     {% endif %}
  16.     {% do elements_canonical(detailUrl, false) %}
  17.     {% do elements_opengraph().setUrl(detailUrl) %}
  18.     {% do elements_head_title().setTitle((product.seoTitle ?: catTitle ~ product.title ~ ' ' ~ 'von'|trans ~ ' ' ~ brand), true) %}
  19.     {% do elements_head_meta().setDescription((product.seoDescription ?: 'Jetzt über das {Category}Modell {Producttitle} von {Brand} informieren, Produktbroschüren lesen und Kuhn-Händler ganz einfach kontaktieren'|trans({'{Category}':catTitle, '{Producttitle}':product.title, '{Brand}':brand})), true) %}
  20.     {% do elements_opengraph().setDescription(product.seoDescription ?: product.shortText) %}
  21.     {% do elements_opengraph().addImage(product.mainImage()) %}
  22.     <main id="main-content" role="main" class="main-content content-block js-content-visibility content-visibility--auto">
  23.         <section class="container">
  24.             {% do breadcrumbHelper().add({
  25.                 'parentId': document.getId(),
  26.                 'url': detailUrl,
  27.                 'label': product.title,
  28.             }) %}
  29.             {{ include('navigation/breadcrumb.html.twig') }}
  30.         </section>
  31.         <section class="container content-block">
  32.             <div class="row gy-4">
  33.                 <div class="col-md-6 order-md-0 order-1">
  34.                     {% set imageGallery = [product.mainImage]|merge(product.imageGallery.items)|merge(brickAttributes['images']|default([])) %}
  35.                     {% if imageGallery is not empty %}
  36.                         {{ include('includes/product/detail-slider.html.twig', {
  37.                             'imageGallery': imageGallery,
  38.                         }) }}
  39.                     {% endif %}
  40.                     {% if product.getShortText(app.request.locale) %}
  41.                         {{ include('includes/area-templates/wysiwyg.html.twig', {
  42.                             className: 'mt-100',
  43.                             content: product.getShortText(app.request.locale),
  44.                         }) }}
  45.                     {% endif %}
  46.                     {% if product.getDescription(app.request.locale) %}
  47.                         {{ include('includes/area-templates/wysiwyg.html.twig', {
  48.                             className: not product.getShortText(app.request.locale) ? 'mt-100' : 'mt-0',
  49.                             content: product.getDescription(app.request.locale),
  50.                         }) }}
  51.                     {% endif %}
  52.                     {% if brickAttributes['attributes']['th'] is defined and brickAttributes['attributes']['td'] is defined %}
  53.                         <section class="{{ not product.getShortText(app.request.locale) ? 'mt-100' }} mb-5 content-block-small">
  54.                             {{ include('includes/product/detail-table-vertical.html.twig', {
  55.                                 'th': brickAttributes['attributes']['th'],
  56.                                 'td': brickAttributes['attributes']['td'],
  57.                             }) }}
  58.                         </section>
  59.                     {% endif %}
  60.                     {% if product.internalBrand == 'palfinger' %}
  61.                         {% if brickAttributes and brickAttributes['table'] is defined and brickAttributes['table']['head'] and brickAttributes['table']['body'] %}
  62.                             <section class="mb-5 content-block-small">
  63.                                 {{ include('includes/product/detail-table-horizontal.html.twig', {
  64.                                     'th': ['']|merge(brickAttributes['table']['head']),
  65.                                     'td': brickAttributes['table']['body'],
  66.                                 }) }}
  67.                             </section>
  68.                         {% endif %}
  69.                     {% endif %}
  70.                     {% if product.getVideos() %}
  71.                         <div class="container-small">
  72.                             {% for video in product.getVideos().items %}
  73.                                 {% if video.video is not empty or video.videoUrl is not empty  %}
  74.                                     {% if video.video is not empty %}
  75.                                         {{ include('includes/media/video.html.twig', {
  76.                                             video: video.video,
  77.                                             aspectRatio: '16x9',
  78.                                             imageThumbnail: 'media-area',
  79.                                             isLightbox: true,
  80.                                             attributes: {
  81.                                                 'playsinline': true,
  82.                                             },
  83.                                             removeAttribute: ['controls']
  84.                                         }) }}
  85.                                     {% endif %}
  86.                                     {% if video.videoUrl is not empty and video.video is empty %}
  87.                                         <div class="d-block video__container js-video ratio ratio-16x9">
  88.                                             {% set sourceExternalVideo = video.videoUrl %}
  89.                                             {% set videoUrl = video.videoUrl %}
  90.                                             {% set videoDescription = videoDescription|default('') %}
  91.                                             {% embed('@ElementsCmsTools/consent-overlay.html.twig') with {
  92.                                                 'classNames': {
  93.                                                     'wrapper': 'consent ratio-item',
  94.                                                     'overlay': 'consent__overlay ratio-item',
  95.                                                     'template': 'ratio-item',
  96.                                                 },
  97.                                                 'service': 'marketing',
  98.                                                 'buttonText': 'cookies.Marketingcookies akzeptieren'|trans,
  99.                                                 'overlayText': 'cookies.Um das Video anzusehen, müssen Sie die Cookies akzeptieren'|trans
  100.                                             } %}
  101.                                                 {% block consentIframe %}
  102.                                                     <a href="" data-src='{{ sourceExternalVideo }}' class="js-lightbox__item ratio-item">
  103.                                                         <img src="{{ elements_videoHelper().getYoutubePoster(videoUrl|split('/')|last) }}" class="ratio-item media-video shadow" alt="{{ videoDescription }}"/>
  104.                                                         <button type="button" class="box-shadow-hover btn-play">
  105.                                                             <span class="btn-play__icon icon icon-play" aria-label="{{ 'global.openVideoPlayer'|trans }}"></span>
  106.                                                             <span class="btn-play__text">{{ 'global.playVideo'|trans }}</span>
  107.                                                         </button>
  108.                                                     </a>
  109.                                                 {% endblock %}
  110.                                             {% endembed %}
  111.                                         </div>
  112.                                     {% endif %}
  113.                                 {% endif %}
  114.                             {% endfor %}
  115.                         </div>
  116.                     {% endif %}
  117.                 </div>
  118.                 <div class="col-md-4 offset-md-1 order-md-1 order-0">
  119.                     {{ include('includes/product/detail-sideInfo.html.twig', {
  120.                         'product': product,
  121.                         'parent': document,
  122.                         'parentUrl': document.fullPath,
  123.                         'brand': brand,
  124.                         'model': product.getTitle(app.request.locale) ?: product.getTitle('de'),
  125.                         'category': product.category,
  126.                         'contact': contactForProduct(product),
  127.                         'downloads': product.getDownloads(app.request.locale) ?: product.getDownloads('en'),
  128.                         'detailUrl': detailUrl,
  129.                     }) }}
  130.                 </div>
  131.             </div>
  132.         </section>
  133.         {% if document.getProperty('productTeaser') %}
  134.             {{ pimcore_inc(document.getProperty('productTeaser')) }}
  135.         {% endif %}
  136.     </main>
  137.     {{ pimcore_placeholder('jsFile').set("js/content") }}
  138. {% endblock %}