bundles/FoxHabbit/BasisBundle/Resources/views/AreaIncludes/image-with-copyright-caption.html.twig line 1

Open in your IDE?
  1. {% if editmode and editmode_figure_class|default(false) %}
  2.     {% set figure_class = editmode_figure_class %}
  3. {% else %}
  4.     {% set figure_class = figure_class|default(config.image_module.figure_class|default('')) %}
  5. {% endif %}
  6. {% set image_thumbnail = image_thumbnail|default(config.image_module.image_thumbnail) %}
  7. {% if editmode and editmode_image_class|default(false) %}
  8.     {% set image_class = editmode_image_class %}
  9. {% else %}
  10.     {% set image_class = image_class|default(config.image_module.image_class|default('')) %}
  11. {% endif %}
  12. {% set caption_class = caption_class|default(config.image_module.caption_class|default('')) %}
  13. {% set caption_contains_html = caption_contains_html|default(config.image_module.caption_contains_html|default(false)) %}
  14. {% set link_href = link_href|default(false) %}
  15. {% set link_target = link_target|default('') %}
  16. {% set image_tag = image_tag|default('image') %}
  17. {% set is_figure = is_figure is defined ? is_figure : true %}
  18. {% set enablePhotoswipe = enable_photoswipe|default(config.enable_photoswipe|default(false)) %}
  19. {% set imageAsset = pimcore_image(image_tag).getImage() %}
  20. {% if editmode or imageAsset %}
  21.     {% set title = '' %}
  22.     {% set copyright = '' %}
  23.     {% if imageAsset %}
  24.         {% set title = imageAsset.getMetadata('title') %}
  25.         {% if imageAsset.getMetadata('copyright') %}
  26.             {% set copyright = '© ' ~ imageAsset.getMetadata('copyright') %}
  27.         {% endif %}
  28.     {% endif %}
  29.     {% if is_figure %}
  30.         <figure class="{{figure_class}}">
  31.     {% endif %}
  32.     {% if link_href and not editmode %}
  33.         <a href="{{link_href}}"{% if link_target %} target="{{ link_target }}"{% endif %} data-debug-thumbnail="{{image_thumbnail}}">
  34.             {{ pimcore_image(image_tag,{thumbnail:image_thumbnail, imgAttributes:{class:image_class}}) }}
  35.         </a>
  36.     {% elseif not editmode and enablePhotoswipe %}
  37.         <a href="{{ imageAsset.getFullPath() }}" data-image-width="{{imageAsset.getWidth()}}" data-image-height="{{imageAsset.getHeight()}}" data-image-title="{{ title }}" data-image-copyright="{{ copyright }}" target="_blank" data-debug-thumbnail="{{image_thumbnail}}" class="open-photoswipe">
  38.             {{ pimcore_image(image_tag,{thumbnail:image_thumbnail, imgAttributes:{class:image_class}}) }}
  39.         </a>
  40.     {% else %}
  41.         {{ pimcore_image(image_tag,{thumbnail:image_thumbnail, imgAttributes:{class:image_class, 'data-debug-thumbnail':image_thumbnail}}) }}
  42.     {% endif %}
  43.     {% if is_figure and (title or copyright or editmode or pimcore_input( 'imageCaption').getValue()) %}
  44.         <figcaption class="{{caption_class}}">
  45.             {% if editmode or pimcore_input( 'imageCaption').getValue() %}
  46.                 {% if not editmode and caption_contains_html %}
  47.                     {{ pimcore_input( 'imageCaption', {placeholder:title ~ ' ' ~ copyright, htmlspecialchars:false})|raw }}
  48.                 {% else  %}
  49.                     {{ pimcore_input( 'imageCaption', {placeholder:title ~ ' ' ~ copyright}) }}
  50.                 {% endif %}
  51.             {% else %}
  52.                 {{ title }}
  53.                 {% if copyright %}
  54.                     <small>{{ copyright }}</small>
  55.                 {% endif %}
  56.             {% endif %}
  57.         </figcaption>
  58.     {% endif %}
  59.     {% if imageAsset %}
  60.         {% do pimcore_head_meta().appendProperty('og:image',app.request.getSchemeAndHttpHost() ~ imageAsset.getThumbnail('share_image').getPath()) %}
  61.     {% endif %}
  62.     {% if is_figure %}
  63.         </figure>
  64.     {% endif %}
  65. {% endif %}