app/template/default/index.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% extends 'default_frame.twig' %}
  9. {% set body_class = 'front_page' %}
  10. {% block main %}
  11.     {# 重要/緊急お知らせアラート(表示期間内の全件を表示) #}
  12.     {% set ImportantNewsList = repository('Eccube\\Entity\\News').findActiveImportantNewsList() %}
  13.     {% for news in ImportantNewsList %}
  14.         {# 緊急(2)は赤、重要(1)は黄色 #}
  15.         {% set alertClass = news.importanceLevel == 2 ? 'alert-danger' : 'alert-warning' %}
  16.         {% set iconClass = news.importanceLevel == 2 ? 'fa-exclamation-triangle' : 'fa-bullhorn' %}
  17.         {% set labelText = news.importanceLevel == 2 ? '緊急' : '重要' %}
  18.         <div class="alert {{ alertClass }} alert-dismissible fade show mx-0 mb-3" role="alert">
  19.             <i class="fa {{ iconClass }} fa-lg me-2"></i>
  20.             <span class="badge bg-{{ news.importanceLevel == 2 ? 'danger' : 'warning' }} me-2 fs-6">{{ labelText }}</span>
  21.             <span class="fw-bold">
  22.                 {{ news.publish_date|date_day }}
  23.                 {% if news.url %}
  24.                     <a href="{{ news.url }}" class="alert-link" {% if news.link_method == '1' %}target="_blank" rel="noopener"{% endif %}>
  25.                         {{ news.title }}
  26.                     </a>
  27.                 {% else %}
  28.                     <a href="{{ url('news_detail', {'id': news.id}) }}" class="alert-link ps-3">
  29.                         {{ news.title }}
  30.                     </a>
  31.                 {% endif %}
  32.             </span>
  33.         </div>
  34.     {% endfor %}
  35. {% endblock %}