custom/plugins/TcinnThemeWareClean/src/Resources/views/storefront/element/cms-element-twt-text-teaser.html.twig line 1

Open in your IDE?
  1. {# ThemeWare: CMS element "Text teaser" #}
  2. {# TODO: prüfen... #}
  3. {# ---------------- START: SET VARS ---------------- #}
  4. {# ThemeWare: Set variables #}
  5. {#% set twtTextTeaser = element.translated.config %#}
  6. {% set twtTextTeaser = element.fieldConfig.elements %}
  7. {# Tab: Layout #}
  8. {% set twtTextTeaserFontFamily = twtTextTeaser.fontFamily.value %}
  9. {% set twtTextTeaserHoverEffect = twtTextTeaser.hoverEffect.value %}
  10. {% set twtTextTeaserTextShadow = twtTextTeaser.textShadow.value %}
  11. {# TODO... #}
  12. {# Tab: Advanced #}
  13. {% set twtTextTeaserCssClass = twtTextTeaser.cssClass.value %}
  14. {# ---------------- END: SET VARS ---------------- #}
  15. {# ---------------- START: SET CLASSES ---------------- #}
  16. {% set overlayClasses = ['overlay'] %}
  17. {% if twtTextTeaserHoverEffect != 'none' %}
  18.     {% if twtTextTeaserHoverEffect != "fadeOut" %}
  19.         {% set overlayClasses = ['fade-in']|merge(overlayClasses) %}
  20.     {% else %}
  21.         {% set overlayClasses = ['fade-out']|merge(overlayClasses) %}
  22.     {% endif %}
  23. {% endif %}
  24. {% set contentClasses = ['content'] %}
  25. {% if twtTextTeaserHoverEffect != 'none' %}
  26.     {% if twtTextTeaserHoverEffect == "slideIn" %}
  27.         {% set contentClasses = ['fade-in']|merge(contentClasses) %}
  28.     {% elseif twtTextTeaserHoverEffect == "slideInUp" %}
  29.         {% set contentClasses = ['fade-in-up']|merge(contentClasses) %}
  30.     {% elseif twtTextTeaserHoverEffect == "slideInRight" %}
  31.         {% set contentClasses = ['fade-in-right']|merge(contentClasses) %}
  32.     {% elseif twtTextTeaserHoverEffect == "slideInDown" %}
  33.         {% set contentClasses = ['fade-in-down']|merge(contentClasses) %}
  34.     {% elseif twtTextTeaserHoverEffect == "slideInLeft" %}
  35.         {% set contentClasses = ['fade-in-left']|merge(contentClasses) %}
  36.     {% elseif twtTextTeaserHoverEffect == "zoomIn" %}
  37.         {% set contentClasses = ['zoom-in']|merge(contentClasses) %}
  38.     {% elseif twtTextTeaserHoverEffect == "fadeOut" %}
  39.         {% set contentClasses = ['fade-out']|merge(contentClasses) %}
  40.     {#% elseif twtTextTeaserHoverEffect == null %}
  41.         {% set contentClasses = ['fade-in-right']|merge(contentClasses) %#}
  42.     {% endif %}
  43. {% endif %}
  44. {% if twtTextTeaserTextShadow == "small" %}
  45.     {% set textClasses = 'twt-shadow-sm' %}
  46. {% elseif twtTextTeaserTextShadow == "regular" %}
  47.     {% set textClasses = 'twt-shadow' %}
  48. {% elseif twtTextTeaserTextShadow == "large" %}
  49.     {% set textClasses = 'twt-shadow-lg' %}
  50. {% endif %}
  51. {# ---------------- END: SET CLASSES ---------------- #}
  52. {% block element_twt_text_teaser %}
  53.     {% set config = element.fieldConfig.elements %}
  54.     {# TODO: finalize #}
  55.     <div class="cms-element-{{ element.type }}{% if config.verticalAlign.value %} has-vertical-alignment{% endif %}{% if twtTextTeaserHoverEffect != 'none' %} is-hover{% endif %}{% if twtTextTeaserCssClass is not empty %} {{ twtTextTeaserCssClass }}{% endif %}">
  56.         {% block element_twt_text_teaser_content %}
  57.             {% if config.verticalAlign.value %}
  58.                 <div class="cms-element-alignment{% if config.verticalAlign.value == "center" %} align-self-center{% elseif config.verticalAlign.value == "flex-end" %} align-self-end{% else %} align-self-start{% endif %}">
  59.             {% endif %}
  60.             {% block element_twt_text_teaser_image_inner %}
  61.                 {# ThemeWare: Set 'Text teaser' element #}
  62.                 {% set textTeaser %}
  63.                     <div class="twt-text-teaser-container cms-content-container justify-content-{{ config.horizontalAlignment.value }} align-items-{{ config.verticalAlignment.value }}">
  64.                         {# Colored overlay (if configured) #}
  65.                         {% if config.colorOverlay.value %}
  66.                             <div class="twt-text-teaser-overlay color-overlay {{ overlayClasses|sort|join(' ') }}" style="background-color: {{ config.colorOverlayBgColor.value }};"></div>
  67.                         {% endif %}
  68.                         {# Text (mandatory) #}
  69.                         <div class="twt-text-teaser-content {{ contentClasses|sort|join(' ') }}{% if twtTextTeaserFontFamily !='base' %} twt-font-family-{{ twtTextTeaserFontFamily }}{% endif %}" style="text-align: {{ config.textAlignment.value }}; max-width: {{ config.maxWidth.value }};">
  70.                             <p class="twt-text-teaser-text text{% if textClasses %} {{ textClasses }}{% endif %}" style="color: {{ config.textColorTitle.value }};">
  71.                                 {{ element.translated.config.title.value }}
  72.                             </p>
  73.                         </div>
  74.                     </div>
  75.                 {% endset %}
  76.                 {# ThemeWare: Set image element #}
  77.                 {% set imageElement %}
  78.                     {% block element_twt_text_teaser_image_container %}
  79.                         {% if element.data.media.url %}
  80.                             <div class="twt-text-teaser-image-container cms-image-container is-{{ element.translated.config.displayMode.value }}" {% if element.translated.config.minHeight.value and element.translated.config.displayMode.value == "cover" %} style="min-height: {{ element.translated.config.minHeight.value }};"{% endif %}>
  81.                                 {% block element_twt_text_teaser_image_media %}
  82.                                     {% set attributes = {
  83.                                         'class': 'cms-image',
  84.                                         'alt': (element.data.media.translated.alt ?: ''),
  85.                                         'title': (element.data.media.translated.title ?: '')
  86.                                     } %}
  87.                                     {% if element.translated.config.displayMode.value == 'cover' or element.translated.config.displayMode.value == 'contain' %}
  88.                                         {% set attributes = attributes|merge({ 'data-object-fit': element.translated.config.displayMode.value }) %}
  89.                                     {% endif %}
  90.                                     {% sw_thumbnails 'cms-image-thumbnails' with {
  91.                                         media: element.data.media
  92.                                     } %}
  93.                                 {% endblock %}
  94.                                 {# ThemeWare: Load 'Text teaser' element #}
  95.                                 {{ textTeaser }}
  96.                             </div>
  97.                         {% endif %}
  98.                     {% endblock %}
  99.                 {% endset %}
  100.                 {# ThemeWare: Load elements #}
  101.                 {% if element.translated.config.url.value %}
  102.                     {# Info: Title tag = Title text (as the text is mandatory) #}
  103.                     <a href="{{ element.translated.config.url.value }}"
  104.                        title="{{ element.translated.config.title.value }}"
  105.                        class="cms-image-link"
  106.                        {% if element.translated.config.newTab.value %}target="_blank" rel="noopener"{% endif %}>
  107.                         {# ThemeWare: Load image element #}
  108.                         {{ imageElement }}
  109.                     </a>
  110.                 {% else %}
  111.                     {# ThemeWare: Load image element #}
  112.                     {{ imageElement }}
  113.                 {% endif %}
  114.             {% endblock %}
  115.             {% if config.verticalAlign.value %}
  116.                 </div>
  117.             {% endif %}
  118.         {% endblock %}
  119.     </div>
  120. {% endblock %}