src/Package/Openform/Front/Templates/_blocks_sections/_text_image.html.twig line 1

Open in your IDE?
  1. {% from '@openform_front_templates/_includes/_icons.html.twig' import arrowright %}
  2. {% set img = block.imagePath %}
  3. {% if block.Translation[app.request.locale].title or block.Translation[app.request.locale].text or img %}
  4.     {% set mobile = openform_front_util.isMobileDevice() %}
  5.     {# image position #}
  6.     {# 
  7.      IMAGE_POSITION_LEFT = 'left';
  8.      IMAGE_POSITION_RIGHT = 'right';
  9.      IMAGE_POSITION_CENTER = 'center'; 
  10.     #}
  11.     {# {% if block.imagePosition == constant('\\App\\Package\\Openform\\Base\\Entity\\AbstractArticleBlock::IMAGE_POSITION_LEFT') %} #}
  12.         <section class="block-item block-image {% if mobile %}block-text--mobile block-image--mobile{% endif %} {% if not mobile %}block-image--position-{{ block.imagePosition }}{% endif %}">
  13.             {% if block.Translation[app.request.locale].title and block.titleOnImage == false %}
  14.                 <div class="block-image__title block__h3 {% if block.Translation[app.request.locale].link %}hover{% endif %}">
  15.                 {% if block.Translation[app.request.locale].link %} <a href="{{block.Translation[app.request.locale].link}}">{% endif %}
  16.                     {{ block.Translation[app.request.locale].title|raw }}
  17.                 {% if block.Translation[app.request.locale].link %} </a>{% endif %}
  18.                 </div>
  19.             {% endif %}
  20.             
  21.             
  22.             <div class="block-image__container"{% if block.titleOnImage and mobile %}style="flex-direction: column-reverse;"{% endif %}>
  23.                 <div class="block-image__text {% if block.Translation[app.request.locale].link %}hover{% endif %}" {% if not mobile %}style="{{ (block.imagePosition == "left" or block.imagePosition =="right") and block.textBlockWidth ? 'width: ' ~ block.textBlockWidth ~ '%;' : block.textBlockWidth ? 'max-width: ' ~ block.textBlockWidth ~ '%;' }} {{block.textBlockPaddingLeft is same as(0) ? 'padding-left: 0px;' : block.textBlockPaddingLeft ? 'padding-left: ' ~ block.textBlockPaddingLeft ~ 'px;' }} {{block.textBlockPaddingRight is same as(0) ? 'padding-right: 0px;' : block.textBlockPaddingRight ? 'padding-right: ' ~ block.textBlockPaddingRight ~ 'px;' }} {{block.textBlockPaddingTop is same as(0) ? 'padding-top: 0px;' : block.textBlockPaddingTop ? 'padding-top: ' ~ block.textBlockPaddingTop ~ 'px;'}} {{block.textBlockPaddingBottom is same as(0) ? 'padding-bottom: 0px;' : block.textBlockPaddingBottom ? 'padding-bottom: ' ~ block.textBlockPaddingBottom ~ 'px;' }}"{% endif %}>
  24.                 {% if block.Translation[app.request.locale].link %} <a href="{{block.Translation[app.request.locale].link}}">{% endif %}
  25.                     {% if block.Translation[app.request.locale].text %}
  26.                         <div class="block__text" {% if block.titleOnImage and mobile %}style="margin-top: 27px;"{% endif %}>
  27.                             {{ block.Translation[app.request.locale].text|raw }}
  28.                         </div>
  29.                     {% endif %}
  30.                     {% if (block.Translation[app.request.locale].link and block.Translation[app.request.locale].buttonLabel and not mobile) or (block.titleOnImage and block.Translation[app.request.locale].link and block.Translation[app.request.locale].buttonLabel and mobile) %}
  31.                         <div class="block-text__btns">
  32.                             <div class="block-text__btns__btn">
  33.                                 <span>{{ block.Translation[app.request.locale].buttonLabel }}</span>
  34.                                 {{arrowright()}}
  35.                             </div>
  36.                         </div>
  37.                     {% endif %}
  38.                 {% if block.Translation[app.request.locale].link %}</a>{% endif %}
  39.                 </div>
  40.                 <div class="block-image__image" {% if not mobile %}style="{{ (block.imagePosition == "left" or block.imagePosition =="right") and block.textBlockWidth ? 'width: calc(100% - ' ~ block.textBlockWidth ~ '%);' }}"{% endif %}>
  41.                     {% if block.Translation[app.request.locale].link %} <a href="{{block.Translation[app.request.locale].link}}" style="height: fit-content; display: flex; flex-direction: column;">{% endif %}
  42.                     
  43.                     {% if block.Translation[app.request.locale].title and block.titleOnImage %}
  44.                         <div class="block-image__image__title block__h4" style="background: {{block.colorTitleBackground|default('#F5DB7B') }};">
  45.                             {{ block.Translation[app.request.locale].title|raw }}
  46.                         </div>
  47.                     {% endif %}
  48.                     {% if img %}
  49.                         <img class="block-image__image__img" loading="lazy" src="{{asset(img)}}" alt="{{ block.Translation[app.request.locale].fileAlt }}">
  50.                     {% endif %}
  51.                     {% if block.Translation[app.request.locale].link %}</a>{% endif %}
  52.                     {% set alt = block.Translation[app.request.locale].fileaudioAlt %}
  53.                     {% set fileTitle = block.Translation[app.request.locale].fileaudioTitle %}
  54.                     {% if block.filePath and openform_front_util.isMp3File(block.filePath) %}
  55.                     <div class="block-image__image__audio">
  56.                         <div class="block-audio__player">
  57.                             <audio controls class="js-audio-player block-audio__inner">
  58.                                 <source src="{{ block.filePath }}" aria-label="{{alt}}" title="{{fileTitle}}">
  59.                                 Your browser does not support the audio element.
  60.                             </audio>
  61.                         </div>
  62.                     </div>
  63.                     {% endif %}
  64.                     {% if block.Translation[app.request.locale].link and block.Translation[app.request.locale].buttonLabel and mobile and not block.titleOnImage  %}
  65.                         <div class="block-text__btns">
  66.                             <div class="block-text__btns__btn">
  67.                                 <span>{{ block.Translation[app.request.locale].buttonLabel }}</span>
  68.                                 {{arrowright()}}
  69.                             </div>
  70.                         </div>
  71.                     {% endif %}
  72.                 </div>
  73.             </div>
  74.     </section>
  75. {% endif %}