custom/plugins/NetzpBlog6/src/Resources/views/storefront/element/cms-element-netzp-blog6.html.twig line 1

Open in your IDE?
  1. {% block blog_content_posts %}
  2.     {% set searchResult = element.data.result %}
  3.     <div class="netzp-blog6-list" id="blog">
  4.         {% if(element.data.pluginConfig.showcategory and
  5.             element.config.category.value != null and
  6.             element.config.category.value != '00000000000000000000000000000000') %}
  7.             {% set firstPost = searchResult|first %}
  8.             {% block blog_content_category %}
  9.                 <div class="card mt-4 mb-4">
  10.                     <h2 class="card-header">
  11.                         {{ firstPost.category.translated.title }}
  12.                     </h2>
  13.                     {% if(firstPost.category.translated.teaser) %}
  14.                         <div class="card-body m-2">
  15.                             {{ firstPost.category.translated.teaser|raw }}
  16.                         </div>
  17.                     {% endif %}
  18.                 </div>
  19.             {% endblock %}
  20.         {% endif %}
  21.         {% if element.config.layout.value == 'slider' %}
  22.             {% sw_include "@Storefront/storefront/element/blog-index-slider.html.twig" %}
  23.         {% else %}
  24.             {% set filterUrl = null %}
  25.             {% set dataUrl = null %}
  26.             {% if page.header.navigation.active.id %}
  27.                 {% set filterUrl = url('frontend.cms.navigation.filter', { navigationId: page.header.navigation.active.id }) %}
  28.                 {% set dataUrl = url('frontend.cms.navigation.page', { navigationId: page.header.navigation.active.id }) %}
  29.             {% endif %}
  30.             {% set currentPage = ((searchResult.criteria.offset + 1) / searchResult.criteria.limit )|round(0, 'ceil') %}
  31.             {% set paginationConfig = { page: currentPage } %}
  32.             {% set paginationOptions = {
  33.                 dataUrl: dataUrl,
  34.                 filterUrl: filterUrl,
  35.                 scrollTopListingWrapper: true,
  36.                 snippets: {
  37.                     resetAllButtonText: 'netzp.blog.filter.reset'|trans
  38.                 }
  39.             } %}
  40.             <div class="cms-element-sidebar-filter">
  41.                 {% if element.config.filterCategory.value or element.config.filterTags.value or element.config.filterAuthor.value %}
  42.                     <button class="btn header-actions-btn filter-panel-wrapper-toggle mb-4 mb-lg-4"
  43.                             type="button"
  44.                             data-offcanvas-filter="true"
  45.                             aria-haspopup="true"
  46.                             aria-expanded="false"
  47.                             aria-label="{{ "general.menuLink"|trans }}">
  48.                         {% block element_product_listing_filter_button_icon %}
  49.                             {% sw_icon 'sliders-horizontal' %}
  50.                         {% endblock %}
  51.                         {{ "listing.filterTitleText"|trans }}
  52.                     </button>
  53.                     <div id="filter-panel-wrapper"
  54.                          class="filter-panel-wrapper"
  55.                          data-offcanvas-filter-content="true">
  56.                         <div class="filter-panel-offcanvas-header">
  57.                             <div class="filter-panel-offcanvas-only filter-panel-offcanvas-title">{{ "listing.filterTitleText"|trans }}</div>
  58.                             <div class="filter-panel-offcanvas-only filter-panel-offcanvas-close js-offcanvas-close">
  59.                                 {% sw_icon 'x' style { 'size': 'md' } %}
  60.                             </div>
  61.                         </div>
  62.                         <div class="filter-panel row mt-4 mt-lg-4">
  63.                             <div class="filter-panel-items-container col-12 col-lg-6">
  64.                                 {% set categories = searchResult.aggregations.get('categories') %}
  65.                                 {% set categoriesSorted = categories.entities|sort((a, b) => a.translated.title <=> b.translated.title) %}
  66.                                 {% if element.config.filterCategory.value and categoriesSorted %}
  67.                                     {% sw_include '@Storefront/storefront/element/filter/category-filter.html.twig' with {
  68.                                         elements: categoriesSorted,
  69.                                         name: 'categories',
  70.                                         displayName: 'netzp.blog.filter.categories'|trans
  71.                                     } %}
  72.                                 {% endif %}
  73.                                 {% set authors = searchResult.aggregations.get('authors') %}
  74.                                 {% set authorsSorted = authors.entities|sort((a, b) => a.translated.name <=> b.translated.name) %}
  75.                                 {% if element.config.filterAuthor.value and authorsSorted %}
  76.                                     {% sw_include '@Storefront/storefront/component/listing/filter/filter-multi-select.html.twig' with {
  77.                                         elements: authorsSorted,
  78.                                         name: 'authors',
  79.                                         displayName: 'netzp.blog.filter.authors'|trans
  80.                                     } %}
  81.                                 {% endif %}
  82.                                 {% set tags = searchResult.aggregations.get('tags') %}
  83.                                 {% set tagsSorted = tags.entities|sort((a, b) => a.name <=> b.name) %}
  84.                                 {% if element.config.filterTags.value and tagsSorted %}
  85.                                     {% sw_include '@Storefront/storefront/element/filter/tags-filter.html.twig' with {
  86.                                         elements: tagsSorted,
  87.                                         name: 'tags',
  88.                                         displayName: 'netzp.blog.filter.tags'|trans
  89.                                     } %}
  90.                                 {% endif %}
  91.                             </div>
  92.                             <div class="filter-panel-active-container col-12 col-lg-6"></div>
  93.                         </div>
  94.                     </div>
  95.                 {% endif %}
  96.                 <div class="cms-element-product-listing-wrapper"
  97.                      data-listing-pagination="true"
  98.                      data-listing-pagination-options='{{ paginationConfig|json_encode }}'
  99.                      data-listing="true"
  100.                      data-listing-options='{{ paginationOptions|json_encode }}'>
  101.                     <div class="cms-element-product-listing">
  102.                         <div class="row cms-listing-row js-listing-wrapper">
  103.                             {% if searchResult.total > 0 %}
  104.                                 {% if element.config.layout.value == 'list' %}
  105.                                     <div class="blog-list">
  106.                                 {% endif %}
  107.                                 {% for post in searchResult.elements %}
  108.                                     {% if element.config.layout.value == 'cards' %}
  109.                                         {% sw_include "@Storefront/storefront/element/blog-index-card.html.twig" %}
  110.                                     {% elseif element.config.layout.value == 'list' %}
  111.                                         {% sw_include "@Storefront/storefront/element/blog-index-listitem.html.twig" %}
  112.                                     {% elseif element.config.layout.value == 'tpl' %}
  113.                                         {% sw_include "@Storefront/storefront/element/blog-index-template.html.twig" %}
  114.                                     {% endif %}
  115.                                 {% endfor %}
  116.                                 {% if element.config.layout.value == 'list' %}
  117.                                     </div>
  118.                                 {% endif %}
  119.                             {% else %}
  120.                                 <div class="cms-listing-col col-12">
  121.                                     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  122.                                         type: 'info', content: 'netzp.blog.msg.noposts'|trans|sw_sanitize
  123.                                     } %}
  124.                                 </div>
  125.                             {% endif %}
  126.                         </div>
  127.                         {% if (not element.config.noPagination.value) and (searchResult.total > searchResult.limit) %}
  128.                             <br>
  129.                             {% sw_include '@Storefront/storefront/component/pagination.html.twig' with {
  130.                                 entities: searchResult,
  131.                                 criteria: searchResult.criteria
  132.                             } %}
  133.                         {% endif %}
  134.                     </div>
  135.                 </div>
  136.             </div>
  137.         {% endif %}
  138.     </div>
  139. {% endblock %}