templates/bundles/ProviderBundle/areas/promocontent/view.html.twig line 1

Open in your IDE?
  1. {% from '@Provider/macros/media.html.twig' import media as conecto_media %}
  2. {% from '@Provider/macros/media_edit.html.twig' import media_edit as conecto_media_edit %}
  3. {% from '@Provider/macros/include-svg.html.twig' import includeSvg %}
  4. {# Default block settings #}
  5. {% set class = pimcore_input('class').getData() %}
  6. {% set marginTop = pimcore_select('margin_top').getData() %}
  7. {% set marginBottom = pimcore_select('margin_bottom').getData() %}
  8. {% set containerWidth = pimcore_select('container_width').getData() %}
  9. {% set areaClass = class ~ ' ' ~ marginTop ~ ' ' ~ marginBottom ~ ' ' ~ containerWidth %}
  10. {% set anchorId = pimcore_input('anchor').getData() %}
  11. {# Block specific settings #}
  12. {% set htag = pimcore_select('tag').getData() %}
  13. {% set special = pimcore_checkbox('special').isChecked() ? true : false %}
  14. {% set mediaWidth = pimcore_select('media_width').getData() ? pimcore_select('media_width').getData() : 50 %}
  15. {% set textWidth = pimcore_select('media_width').getData() ? (100 - pimcore_select('media_width').getData())  : 50 %}
  16. {% set colRatio = textWidth ~ '-' ~ mediaWidth %}
  17. {% set imageRatio = pimcore_select('ratio').getData() ? pimcore_select('ratio').getData() : 3/2 %}
  18. {% set showLightbox = 0 %}
  19. {% set showCopyright = pimcore_checkbox('copyright').isChecked() %}
  20. {% set showCaption = pimcore_checkbox('caption').isChecked() %}
  21. {# Special video settings #}
  22. {% set videoAddAttributes = {} %}
  23. {% set videoRemoveAttributes = pimcore_checkbox('controls').isChecked() ? [] : ['controls'] %}
  24. {% if pimcore_checkbox('autoplay').isChecked() %}{% set videoAddAttributes = videoAddAttributes|merge({autoplay: '', playsinline: ''}) %}{% endif %}
  25. {% if pimcore_checkbox('loop').isChecked() %}{% set videoAddAttributes = videoAddAttributes|merge({loop: ''}) %}{% endif %}
  26. {% if pimcore_checkbox('mute').isChecked() %}{% set videoAddAttributes = videoAddAttributes|merge({muted: ''}) %}{% endif %}
  27. <div class="area area--promo-content {{ areaClass }}"{% if anchorId %} id="{{ anchorId }}"{% endif %}>
  28.     {% if not pimcore_link('link').isEmpty() %}
  29.     <a href="{{ pimcore_link('link').getHref() }}" {% if pimcore_link('link').getTarget() %}target="{{ pimcore_link('link').getTarget() }}"{% endif %}>
  30.     {% endif %}
  31.         <div class="area--promo-content-inner">
  32.             {% if editmode %}
  33.                 {{ conecto_media_edit(
  34.                     'promocontent_',
  35.                     (1920 * mediaWidth / 100),
  36.                 (1920 * mediaWidth / 100) / imageRatio
  37.                 ) }}
  38.             {% else %}
  39.                 {% if not pimcore_image('promocontent_image').isEmpty() %}
  40.                     {{ conecto_media(
  41.                         pimcore_image('promocontent_image').getImage(),
  42.                         editmode,
  43.                         showLightbox,
  44.                         showCopyright,
  45.                         showCaption,
  46.                         {
  47.                             thumbName: 'promocontent',
  48.                             ratio: imageRatio,
  49.                             cols: 100 / mediaWidth,
  50.                             widgetAltText: pimcore_image('promocontent_image').getAlt()
  51.                         }
  52.                     ) }}
  53.                 {% endif %}
  54.                 {% if not pimcore_video('promocontent_video').isEmpty() %}
  55.                     {{ pimcore_video('promocontent_video', {
  56.                         "width": "100%",
  57.                         "height": "100%",
  58.                         "attributes": videoAddAttributes,
  59.                         "removeAttributes": videoRemoveAttributes
  60.                     }) }}
  61.                 {% endif %}
  62.             {% endif %}
  63.             <div class="promo-content--container text-center">
  64.                 <{{ htag }}{% if special %} class="special"{% endif %}>
  65.                     {{ pimcore_input('promocontent_headline') }}
  66.                     {% if special %}
  67.                         <span class="spacer">{{ includeSvg('diverses/diamond') }}</span>
  68.                     {% endif %}
  69.                     <small>{{ pimcore_input('promocontent_subheadline') }}</small>
  70.                 </{{ htag }}>
  71.                 {% if editmode %}
  72.                     {{ pimcore_link('link', { 'reload': true }) }}
  73.                 {% endif %}
  74.                 {% if not pimcore_link('link').isEmpty() %}
  75.                     <button class="btn btn-{% if pimcore_link('link').getClass() %}{{ pimcore_link('link').getClass() }}{% else %}outline{% endif %}">
  76.                         {{ pimcore_link('link').getText() }}
  77.                     </button>
  78.                 {% endif %}
  79.             </div>
  80.         </div>
  81.     {% if not pimcore_link('link').isEmpty() %}
  82.     </a>
  83.     {% endif %}
  84. </div>