templates/Slivki/comments/comments.html.twig line 1

Open in your IDE?
  1. {% set isLiveComments = isLiveComments is defined  %}
  2. {% set showBanners = showBanners is defined and not isLiveComments %}
  3. {% for comment in comments %}
  4.     {% if isLiveComments %}
  5.         {% include 'Slivki/comments/comments_item.html.twig' %}
  6.     {% else %}
  7.         {{ _self.recursiveComment(comment, isLiveComments, 1) }}
  8.         {% if showBanners %}
  9.             <span id="commentBannerPlaceHolder{{ loop.index }}" class="hidden"></span>
  10.         {% endif %}
  11.     {% endif %}
  12. {% endfor %}
  13. {% if pagination is defined and pagination %}
  14.     {{ pagination|raw }}
  15. {% endif %}
  16. {% if hasMore and comments|length > 0 %}
  17.     <div id="afterCommentsBlock">
  18.         {% set lastEntityID = 0 %}
  19.         {% set lastComment = comments|last %}
  20.         {% if not isLiveComments %}
  21.             {% set lastEntityID = comments|last.getEntityID() %}
  22.             {% set lastComment = comments|last %}
  23.         {% endif %}
  24.         <div class="button--white" onclick="loadComments({{ lastEntityID }}, {{ lastComment.getID() }}, {{ lastComment.getTypeID() }}{{ categoryID is defined ? ', ' ~ categoryID }}{{ directorID is defined ? ', ' ~ directorID }})" id="newCommentsButtons">Ещё отзывы</div>
  25.         {% if not isLiveComments and not is_granted(constant('Slivki\\Entity\\UserGroup::COMMENTS_BANNED_ROLE_NAME')) and lastComment.getTypeID() != constant('Slivki\\Entity\\Comment::TYPE_MALL_BRAND_COMMENT') %}
  26.             <div id="bottomAddVoteLink" class="addVoteLink button">Добавить отзыв</div>
  27.         {% endif %}
  28.     </div>
  29. {% endif %}
  30. {% macro recursiveComment(comment, isLiveComments, level) %}
  31.     {% include 'Slivki/comments/comments_item.html.twig' %}
  32.     {% for child in comment.getChildren()|filter(child => not child.isHidden() and child.isConfirmedPhone()) %}
  33.         {{ level == 1 ? '<ul>' }}
  34.         {{ _self.recursiveComment(child, isLiveComments, level + 1) }}
  35.         {{ level == 1 ? '</ul>' }}
  36.     {% endfor %}
  37. {% endmacro %}