templates/areas/image/view.html.twig line 1

Open in your IDE?
  1. {#
  2. project: Pimcore
  3. User: EBiermann
  4. Year: 2022
  5. #}
  6. {% if editmode %}
  7. <div class="admin-container admin-container--limited-width">
  8.     <div class="admin-container__section">
  9.         <span class="admin-container__title">{{ 'brick.image.title'|trans({}, 'admin') }}</span>
  10.     </div>
  11.     <div class="admin-container__configurations">
  12.         <div class="admin-config-item">
  13.             <span class="admin-config-item__label">{{ 'brick.image.option.link'|trans({}, 'admin') }}:</span>
  14.             {{
  15.                 pimcore_link('link', { 'noText': true })
  16.             }}
  17.             <br>
  18.             <span class="admin-config-item__label">{{ 'brick.image.option.border'|trans({}, 'admin') }}:</span>
  19.             {{
  20.                 pimcore_checkbox('border', { 'reload': true })
  21.             }}
  22.         </div>
  23.     </div>
  24. </div>
  25. {% endif %}
  26. {% set sectionIndex = sectionIndex|default(0) %}
  27. {% set gridIndex = gridIndex|default(0) %}
  28. <!-- thumb: {{ thumbnail }} | section-idx: {{ sectionIndex }} | grid-idx: {{ gridIndex }} -->
  29. <div class="area image {{ cssClasses|join(' ') }}" style="{{ cssStyles|join(' ') }}">
  30.     {# LCP, should not be lazy loaded (images on init page load abvoe the fold) #}
  31.     {% set preventLoadingLazy = not editmode and (sectionIndex == 0 and gridIndex <= 1) %}
  32.     {%
  33.         set content = pimcore_image('image', {
  34.             'class': 'image__image',
  35.             'lowQualityPlaceholder': false,
  36.             'thumbnail': thumbnail|default(false),
  37.             'imgAttributes': {
  38.                 'loading': preventLoadingLazy ? 'eager' : 'lazy',
  39.                 'decoding': editmode ? 'sync' : 'async'
  40.             }
  41.         })
  42.     %}
  43.     {% if not editmode and hasLink %}
  44.         {%
  45.             include 'includes/partials/link-wrapper.html.twig' with {
  46.                 content: content,
  47.                 href: pimcore_link('link').getHref(),
  48.                 title: pimcore_link('link').getTitle()
  49.             }
  50.         %}
  51.     {% else %}
  52.         {{ content|raw }}
  53.     {% endif %}
  54. </div>