templates/includes/heros/content-hero.html.twig line 1

Open in your IDE?
  1. {% set heroType = heroType|default('') ?: pimcore_select('heroType').data %}
  2. {% set siteConfig = getSiteConfig() %}
  3. {% embed 'includes/editmode-box.html.twig' %}
  4.     {% block editmodeSettings %}
  5.         <div class="row">
  6.             <div class="col" style="z-index: 1000">
  7.                 <b>Hero Image:</b> {{ pimcore_image('image', {
  8.                     'width': 100,
  9.                     'required': true
  10.                 }) }}
  11.             </div>
  12.             <div class="col">
  13.                 <b>Hero Type:</b><br>
  14.                 {{ pimcore_select('heroType', {
  15.                     'store': [
  16.                         [ 'standard', 'Simple Hero' ],
  17.                         [ 'fullWidth', 'Full Width' ],
  18.                         [ 'fullWidthAndBigClouds', 'Full Width + More Clouds (default)' ],
  19.                     ],
  20.                     'width': 300,
  21.                     'defaultValue': 'fullWidthAndBigClouds',
  22.                     'reload': true
  23.                 }) }}<br>
  24.             </div>
  25.             {% if heroType == 'fullWidth' or heroType == 'fullWidthAndBigClouds' %}
  26.                 <div class="col">
  27.                     {{ pimcore_checkbox('countdown', {
  28.                         'label': 'Show Countdown?',
  29.                         'reload': true
  30.                     }) }}<br>
  31.                     {% if pimcore_checkbox('countdown').checked %}
  32.                         <b>End Time <small>Format: "2023-03-21T00:00:00+0100"</small></b>
  33.                         {{ pimcore_input('countdownEndTime', {
  34.                             'label': '',
  35.                             'placeholder': '2023-03-21T00:00:00+0100'
  36.                         }) }}
  37.                     {% endif %}
  38.                 </div>
  39.             {% endif %}
  40.         </div>
  41.         {% if useUsps|default(false) %}
  42.             {{ pimcore_relations('usps', {
  43.                 'types' : [ 'object' ],
  44.                 'subtypes' : { 'object' : [ 'object' ] },
  45.                 'class': 'Usp',
  46.                 'title': 'USP Objects',
  47.                 'limit': 4
  48.             }) }}
  49.         {% endif %}
  50.     {% endblock %}
  51. {% endembed %}
  52. {% set image = image|default(false) ?: pimcore_image('image').empty ? null : pimcore_image('image') %}
  53. {% set thumbnail = getContentHeroThumb(type|default('big')) %}
  54. {% if image %}
  55.     {% do elements_opengraph().addImage(image.thumbnail(thumbnail)) %}
  56. {% else %}
  57.     {% do elements_opengraph().addImage(getSiteConfig().fallbackImage) %}
  58. {% endif %}
  59. <section class="{{ className|default('') }} content-hero {{ hasGradient|default(false) and not editmode ? 'content-hero--gradient' : '' }}" style="{{ pimcore_image('image') and pimcore_image('image').empty ? 'margin-top:200px;' : '' }}">
  60.     {% if image and (heroType == 'fullWidth' or heroType == 'fullWidthAndBigClouds') %}
  61.         <div class="content-hero__image">
  62.             <figure class="ratio {{ getContentHeroRatio(type|default('big')) }}">
  63.                 <link rel="preload" href="{{ preload(image.thumbnail(thumbnail).getAsFormat("webp"), { as: 'image', media: '(min-width:768px)' }) }}" as="image" media="(min-width:768px)">
  64.                 <link rel="preload" href="{{ preload(image.thumbnail(thumbnail).getMedia("(max-width: 767px)", 2).getAsFormat("webp"), { as: 'image', media: '(max-width:767px)' }) }}" as="image" media="(max-width:767px)">
  65.                 {{ image.thumbnail(thumbnail).getHtml({
  66.                     'imgAttributes': { 'class': 'ratio-item', 'loading': 'eager', 'data-cookieconsent': 'ignore' },
  67.                     'lowQualityPlaceholder': true
  68.                 })|raw }}
  69.                 {{ image.thumbnail(thumbnail).getHtml({
  70.                     'imgAttributes': { 'class': 'ratio-item', 'loading': 'eager', 'data-cookieconsent': 'ignore' }
  71.                 })|raw }}
  72.             </figure>
  73.             <div class="d-none d-md-block content-hero__clouds {{ heroType == 'fullWidthAndBigClouds' ? '' : 'content-hero__clouds--transparent' }} ratio ratio-hero-clouds ratio-xs-3x2">
  74.                 {% if siteConfig.clouds %}
  75.                     {{ siteConfig.clouds.thumbnail('content-hero-clouds').getHtml({
  76.                         'imgAttributes': {
  77.                             'class': 'ratio-item content-hero__clouds__img',
  78.                             'loading': 'eager'
  79.                         }
  80.                     })|raw }}
  81.                 {% endif %}
  82.             </div>
  83.             <div class="d-md-none content-hero__clouds {{ heroType == 'fullWidthAndBigClouds' ? '' : 'content-hero__clouds--transparent' }} ratio ratio-hero-clouds ratio-xs-3x2">
  84.                 {% set cloudsMobile = siteConfig.cloudsMobile ?: siteConfig.clouds %}
  85.                 {% if cloudsMobile %}
  86.                     {{ cloudsMobile.thumbnail('content-hero-clouds').getHtml({
  87.                         'imgAttributes': {
  88.                             'class': 'ratio-item content-hero__clouds__img',
  89.                             'loading': 'eager'
  90.                         }
  91.                     })|raw }}
  92.                 {% endif %}
  93.             </div>
  94.         </div>
  95.     {% elseif image %}
  96.         <div class="container--move-right pe-0">
  97.             <div class="content-hero__image--spacing">
  98.                 <figure class="ratio ratio-3x1 ratio-xs-1x1">
  99.                     {{ image.thumbnail('content-hero-small').getHtml({
  100.                         'imgAttributes': {
  101.                             'class': 'ratio-item',
  102.                             'loading': 'eager'
  103.                         },
  104.                         'lowQualityPlaceholder': true
  105.                     })|raw }}
  106.                     {{ image.thumbnail('content-hero-small').getHtml({
  107.                         'thumbnail': 'content-hero-small',
  108.                         'imgAttributes': {
  109.                             'class': 'ratio-item',
  110.                             'loading': 'eager'
  111.                         }
  112.                     })|raw }}
  113.                 </figure>
  114.             </div>
  115.         </div>
  116.     {% endif %}
  117.     <div class="container
  118.         {{ (heroType == 'fullWidth' or heroType == 'fullWidthAndBigClouds') and not editmode ? 'content-hero__body--fullwidth' : 'content-hero__body' }}
  119.         {{ (heroType == 'fullWidthAndBigClouds') and not editmode ? 'content-hero__body--fullwidth-clouds': ''  }}
  120.         {{ (heroType == 'fullWidth' or heroType == 'fullWidthAndBigClouds') and not editmode and (useUsps|default(false) or intro|default(false))  ? 'content-hero__body--fullwidth--only-desktop' : '' }}"
  121.     >
  122.         <div class="row gy-3 gy-md-0 pb-3">
  123.             <div class="col-md-6">
  124.                 {{ include('includes/title-blocks/main-title-block.html.twig', {
  125.                     'title': title|default(''),
  126.                     'topTitle': toptitle|default(''),
  127.                     'toptitleStyle': toptitleStyle|default(''),
  128.                     'toptitleLink': toptitleLink|default(''),
  129.                     'toptitleTag': toptitleTag|default('')
  130.                 }, with_context = false) }}
  131.                 {% if not hideBreadcrumbs|default(false) %}
  132.                     {{ breadcrumbHelper() }}
  133.                 {% endif %}
  134.                 {% if intro|default(false) %}
  135.                     <div class="mt-3 mt-md-80 wysiwyg">
  136.                         {{ pimcore_wysiwyg('heroIntro', { 'placeholder': 'Intro Text' }) }}
  137.                     </div>
  138.                 {% endif %}
  139.             </div>
  140.             {% if pimcore_checkbox('countdown') and pimcore_checkbox('countdown').checked() %}
  141.                 <div class="col-md-6">
  142.                     <h3 class="title-block__top-title">
  143.                         {{ pimcore_input('countdownHeadline', { 'placeholder': 'Überschrift' })}}
  144.                     </h3>
  145.                     {{ include('includes/content/countdown.html.twig', { 'endTime': pimcore_input('countdownEndTime') }) }}
  146.                 </div>
  147.             {% endif %}
  148.             {% if useUsps|default(false) and not pimcore_relations('usps').empty %}
  149.                 <div class="col-12">
  150.                     <div class="row g-3 mt-5 mt-md-80">
  151.                         {% for usp in pimcore_relations('usps').elements %}
  152.                             <div class="col-6 col-md-3">
  153.                                 {{ include('includes/content/usp-item.html.twig', {
  154.                                     'usp': usp
  155.                                 }, with_context = false) }}
  156.                             </div>
  157.                         {% endfor %}
  158.                     </div>
  159.                 </div>
  160.             {% endif %}
  161.         </div>
  162.     </div>
  163. </section>