vendor/conecto/pimcore-provider/src/ProviderBundle/Resources/views/partials/header/media.html.twig line 1

Open in your IDE?
  1. {% from '@Provider/macros/media_edit.html.twig' import media_edit as conecto_media_edit %}
  2. <div class="header-media">
  3.     {% if editmode %}
  4.         {{ conecto_media_edit(
  5.             'header_',
  6.             1920,
  7.             1080
  8.         ) }}
  9.     {% else %}
  10.         {% set headerImage = pimcore_image('header_image').getImage() %}
  11.         {% set headerVideo = pimcore_video('header_video').getVideoAsset() %}
  12.         {% if not headerImage and not headerVideo %}
  13.             {# Parent Fallback #}
  14.             {% set headerImage = conecto_get_parent_editable(document, 'header_image') %}
  15.             {% set headerVideo = headerImage ? null : conecto_get_parent_editable(document, 'header_video') %}
  16.             {% if headerImage or headerVideo %}
  17.                 {% set parentDocument = (headerImage ? headerImage.getDocument() : (headerVideo ? headerVideo.getDocument() : null) ) %}
  18.                 {% set headerImage = headerImage ? headerImage.getImage() : null %}
  19.                 {% set headerVideo = headerVideo ? headerVideo.getVideoAsset() : null %}
  20.             {% endif %}
  21.         {% endif %}
  22.     {% endif %}
  23.     {% if headerImage is defined and headerImage is instanceof('\\Pimcore\\Model\\Asset\\Image') %}
  24.         {{ headerImage.getThumbnail('headerImage').getHTML()|raw }}
  25.     {% endif %}
  26.     {% if headerVideo is defined and headerVideo is instanceof('\\Pimcore\\Model\\Asset\\Video') %}
  27.         {# YouTube usw. werden hier bewusst ignoriert, da im Header suboptimal - wenn vom Kunden gewünscht -> individuell umsetzen #}
  28.         <video src="{{ headerVideo }}"{% if not editmode %} autoplay loop muted playsinline{% endif %}></video>
  29.     {% endif %}
  30.     {% if editmode or pimcore_input('header_title') != '' %}
  31.     <div class="header-media--content">
  32.         {% if (pimcore_input('header_title') != "") %}
  33.             <h2>{{ pimcore_input('header_title', { "placeholder": "Titel" }) }}</h2>
  34.         {% endif %}
  35.         {% if (pimcore_input('header_subtitle') != "") %}
  36.             <p>{{ pimcore_input('header_subtitle', { "placeholder": "Untertitel" }) }}</p>
  37.         {% endif %}
  38.         {{ pimcore_link('header_link', {
  39.             "class": "btn-primary"
  40.         }) }}
  41.     </div>
  42.     {% elseif parentDocument is defined and parentDocument is instanceof('\\Pimcore\\Model\\Document') %}
  43.     {# Parent Fallback #}
  44.     <div class="header-media--content">
  45.         {% if conecto_get_editable(parentDocument, 'header_title') != "" %}
  46.             <h2>{{ conecto_get_editable(parentDocument, 'header_title') }}</h2>
  47.         {% endif %}
  48.         {% if conecto_get_editable(parentDocument, 'header_subtitle') != "" %}
  49.             <p>{{ conecto_get_editable(parentDocument, 'header_subtitle') }}</p>
  50.         {% endif %}
  51.         {% if conecto_get_editable(parentDocument, 'header_link') != "" %}
  52.             {{ conecto_get_editable(parentDocument, 'header_link') }}
  53.         {% endif %}
  54.     </div>
  55.     {% endif %}
  56. </div>