templates/website/home/section.html.twig line 1

Open in your IDE?
  1. {% from 'utils.html.twig' import ico %}
  2. {% set items = pageSectionItems(section) %}
  3. {% set itemTemplate = pageSectionTemplateItem(section) %}
  4. {% set background = section.background == enum('PageSectionEnum::YES') ? 'sec-bg-alt' : null %}
  5. {% set format = pageSectionFormat(section.type) %}
  6. {% set positionItem = pageSectionPosition(section.positionItem) %}
  7. {% set positionText = pageSectionPosition(section.positionText) %}
  8. {% set perLine = (section.numberPerline > items|length)? items|length : section.numberPerline %}
  9. {% set ofLines = section.numberOfline  %}
  10. {% set slider = section.slider == enum('PageSectionEnum::YES') ? true : false %}
  11. {% set showAll = pageSectionShowAll(section) %}
  12. {% set linkAll = pageSectionLinkAll(section) %}
  13. {% set sectionClasses = [
  14.         'pag-sec', 
  15.         "sec-#{format}", 
  16.         background, 
  17.         (slider? 'slider slider-destaques':null),
  18.         "sec-items-#{positionItem}", 
  19.         "sec-text-#{positionText}"
  20.     ]|filter(class=> class is not empty)
  21. %}
  22. {% if items|length > 0 %}
  23.     <section class="{{ sectionClasses|join(' ')|trim }}" id="sec-content-{{ section.id }}">
  24.         <div id="container-{{ section.id }}" class="{{ format is not same as('expand')? 'container-boxes' : 'container' }}">
  25.             <header class="tit-sec">
  26.                 <h2>{{ section.title }}</h2>
  27.                 <span class="sub">{{ section.subtitle }}</span>
  28.             </header>
  29.             {# BOXES | SLIDER #}
  30.             <div class="items-section items-{{ format }}{{ format is not same as('expand')? " items-line-#{perLine}" }}">
  31.                 {% if slider %}
  32.                     {# SLIDER ARROWS #}
  33.                     <div id="arrows-slider-{{ section.id }}" class="tns-arrows">
  34.                         <button class="slider-seta slider-seta-prev">{{ ico('arrow-left')  }}</button>
  35.                         <button class="slider-seta slider-seta-next">{{ ico('arrow-right') }}</button>
  36.                     </div>
  37.                 {% endif %}
  38.                 {# SLIDER ITEMS #}
  39.                 <div
  40.                     {% if slider %}
  41.                         id="slider-{{ section.id }}" class="js--slider" data-slider-items="{{ perLine }}"
  42.                         data-slider-options-label="slider-{{ format }}"
  43.                     {% else %}
  44.                         class="products-list-{{ format }}"
  45.                     {% endif %}>
  46.                     {% for ind, item in items %}
  47.                         {% include itemTemplate with { item: item, format: format, ind: ind+1 }%}
  48.                     {% endfor %}
  49.                     {# SHOW MORE #}
  50.                     {% if showAll and slider %}
  51.                         <div class="sec--{{ format }}">
  52.                             <div class="{{ format is not same as('default')? "item":"item-curso" }}">
  53.                                 <a class="link-all" href="{{ linkAll }}">
  54.                                     {{ 
  55.                                         getLanguage('see_all', 'product') }}&nbsp;{{ ico('arrow-right')
  56.                                     }}
  57.                                 </a>
  58.                             </div>
  59.                         </div>
  60.                     {% endif %}
  61.                 </div>
  62.             </div>
  63.             {# SHOW MORE #}
  64.             {% if showAll and not slider %}
  65.                 <div class="btn-box btn-box-home">
  66.                     <a id="btn-product-section" class="btn-ver" href="{{ linkAll }}">{{ getLanguage('see_all', 'product') }}</a>
  67.                 </div>
  68.             {% endif %}
  69.         </div>
  70.     </section>
  71. {% endif %}