app/template/default/Block/npsr_recent_news.twig line 1

Open in your IDE?
  1. {% set NewsList = repository('Eccube\\Entity\\News').getList() %}
  2. <div class="ec-role">
  3.     <div class="ec-newsRole">
  4.         <h2 class="top_title">お知らせ</h2>
  5.         <ul class="list-unstyled mb-0">
  6.             {% for News in NewsList|slice(0, 3) %}
  7.                 <li class="py-3 border-bottom">
  8.                     <div class="d-flex align-items-center gap-3 mb-2">
  9.                         <time class="text-secondary small">{{ News.publish_date|date("Y/m/d") }}</time>
  10.                         {% if News.isUrgent %}
  11.                             <span class="d-inline-flex align-items-center gap-1 small fw-semibold">
  12.                                 <span class="badge bg-danger fs-6">
  13.                                     <i class="fa fa-exclamation-triangle me-1" aria-hidden="true"></i>緊急
  14.                                 </span>
  15.                             </span>
  16.                         {% elseif News.isImportant %}
  17.                             <span class="d-inline-flex align-items-center gap-1 small fw-semibold">
  18.                                 <span class="badge bg-warning fs-6">
  19.                                     <i class="fa fa-bullhorn me-1" aria-hidden="true"></i>重要
  20.                                 </span>
  21.                             </span>
  22.                         {% endif %}
  23.                     </div>
  24.                     <div>
  25.                         {% if News.url %}
  26.                             <a href="{{ News.url }}" class="text-dark text-decoration-none link-hover" {% if News.link_method == '1' %}target="_blank" rel="noopener"{% endif %}>
  27.                                 {{ News.title }}
  28.                             </a>
  29.                         {% else %}
  30.                             <a href="{{ url('news_detail', {'id': News.id}) }}" class="text-dark text-decoration-none link-hover">
  31.                                 {{ News.title }}
  32.                             </a>
  33.                         {% endif %}
  34.                     </div>
  35.                 </li>
  36.             {% endfor %}
  37.         </ul>
  38.         {% if NewsList|length > 3 %}
  39.             <div class="text-end mt-3">
  40.                 <a class="btn-metro-color px-5 py-2 fs-6" href="{{ url('news_index') }}" role="button">一覧を見る</a>
  41.             </div>
  42.         {% endif %}
  43.     </div>
  44. </div>