templates/areas/content-wysiwyg-media/view.html.twig line 1

Open in your IDE?
  1. <section class="wysiwyg-with-medium container content-block {{ not pimcore_input('anchorTitle').isEmpty() ? 'js-anchor-nav__item' }}"
  2.     {% if not pimcore_input('anchorTitle').isEmpty() %} data-anchor-nav-title="{{ pimcore_input('anchorTitle').getData() }}" {% endif %}
  3. >
  4.     {% if editmode %}
  5.         <div class="ms-auto">
  6.             {% embed 'includes/editmode-settings.html.twig' %}
  7.                 {% block additionalSettings %}
  8.                     {{ 'Text Position: ' }}
  9.                     {{ pimcore_select('mediaPosition', {
  10.                         "label": "Text position",
  11.                         "store": [
  12.                             ["left", "Left"],
  13.                             ["right", "Right"]
  14.                         ],
  15.                         "defaultValue": "left"
  16.                     }) }}
  17.                     {{ 'Media Type: ' }}
  18.                     {{ pimcore_select('mediaType', {
  19.                         "store": [
  20.                             ["image", "Image"],
  21.                             ["video", "Video"]
  22.                         ],
  23.                         "defaultValue": "image",
  24.                         "reload": true,
  25.                     }) }}
  26.                     <div>
  27.                         {{ 'Button: ' }}
  28.                         {{ pimcore_link('link') }}
  29.                     </div>
  30.                 {% endblock %}
  31.             {% endembed %}
  32.         </div>
  33.     {% endif %}
  34.     {% set isWysiwygLeft = pimcore_select("mediaPosition").getData() == 'left' ? true : false %}
  35.     {% set mediaType = pimcore_select("mediaType").getData() %}
  36.     {{ include('includes/title-blocks/title-block.html.twig', {
  37.         hideIntro: true,
  38.     }) }}
  39.     <div class="row gy-3">
  40.         {% if isWysiwygLeft %}
  41.             {{ _self.wysiwyg(isWysiwygLeft) }}
  42.         {% endif %}
  43.         {{ _self.media(mediaType, isWysiwygLeft) }}
  44.         {% if not isWysiwygLeft %}
  45.             {{ _self.wysiwyg(isWysiwygLeft) }}
  46.         {% endif %}
  47.     </div>
  48. </section>
  49. {% macro wysiwyg(isWysiwygLeft) %}
  50.     <div class="col-md-4 offset-md-1 {{ isWysiwygLeft ? 'order-1 order-md-0' : '' }}">
  51.         <div class="content-teaser__content">
  52.             {% if editmode or not pimcore_input('headline').isEmpty() %}
  53.                 <h3 class="h4 mb-4">{{ pimcore_input('headline') }}</h3>
  54.             {% endif %}
  55.             {% if editmode or not pimcore_wysiwyg('content').isEmpty() %}
  56.                 <div class="wysiwyg mb-md-5 mb-1">{{ pimcore_wysiwyg('content')|raw }}</div>
  57.             {% endif %}
  58.             {% if not pimcore_link('link').isEmpty() %}
  59.                 <a href="{{ pimcore_link('link').href }}" class="btn btn-primary" target="{{ pimcore_link('link').target }}">
  60.                     {{ pimcore_link('link').text }}
  61.                 </a>
  62.             {% endif %}
  63.         </div>
  64.     </div>
  65. {% endmacro %}
  66. {% macro media(mediaType, isWysiwygLeft) %}
  67.     <div class="col-md-6 {{ isWysiwygLeft ? 'offset-md-1 order-0 order-md-1' : '' }}">
  68.         <div class="{{ isWysiwygLeft ? 'container__break-right-half-md' : 'container__break-left-half-md' }}">
  69.             {% if mediaType == 'image' %}
  70.                 <div class="wysiwyg-with-medium__media position-relative js-lightbox">
  71.                     {{ include('includes/lightbox-image.html.twig', {
  72.                         aspectRatio: '5x3',
  73.                         thumbnail: 'wysiwyg-with-media',
  74.                         imageClassName: 'wysiwyg-with-media__img',
  75.                         button: true
  76.                     }) }}
  77.                 </div>
  78.             {% elseif mediaType == 'video' %}
  79.                 <div class="wysiwyg-with-medium__media">
  80.                     {{ include('includes/media/video.html.twig', {
  81.                         aspectRatio: '5x3',
  82.                         isLightbox: true,
  83.                         imageThumbnail: 'wysiwyg-with-media',
  84.                         attributes: {
  85.                             'playsinline': false,
  86.                         },
  87.                         removeAttribute: ['controls']
  88.                     }) }}
  89.                 </div>
  90.             {% endif %}
  91.         </div>
  92.     </div>
  93. {% endmacro %}