|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
6 | 6 |
|
7 |
| -/** @var Magento\Review\Block\Product\View\ListView $block */ |
8 |
| -/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ |
| 7 | +use Magento\Framework\Escaper; |
| 8 | +use Magento\Framework\View\Helper\SecureHtmlRenderer; |
| 9 | +use Magento\Review\Block\Product\View\ListView; |
| 10 | + |
| 11 | +/** |
| 12 | + * @var ListView $block |
| 13 | + * @var SecureHtmlRenderer $secureRenderer |
| 14 | + * @var Escaper $escaper |
| 15 | + */ |
9 | 16 |
|
10 | 17 | $_items = $block->getReviewsCollection()->getItems();
|
11 | 18 | $format = $block->getDateFormat() ?: \IntlDateFormatter::SHORT;
|
12 | 19 | ?>
|
13 | 20 | <?php if (count($_items)): ?>
|
14 |
| -<div class="block review-list" id="customer-reviews"> |
15 |
| - <?php if (!$block->getHideTitle()): ?> |
16 |
| - <div class="block-title"> |
17 |
| - <strong><?= $block->escapeHtml(__('Customer Reviews')) ?></strong> |
18 |
| - </div> |
19 |
| - <?php endif ?> |
20 |
| - <div class="block-content"> |
21 |
| - <div class="toolbar review-toolbar"> |
22 |
| - <?= $block->getChildHtml('toolbar') ?> |
23 |
| - </div> |
24 |
| - <ol class="items review-items"> |
25 |
| - <?php foreach ($_items as $_review): ?> |
26 |
| - <li class="item review-item" itemscope itemprop="review" itemtype="http://schema.org/Review"> |
27 |
| - <div class="review-title" itemprop="name"><?= $block->escapeHtml($_review->getTitle()) ?></div> |
28 |
| - <?php if (count($_review->getRatingVotes())): ?> |
29 |
| - <div class="review-ratings"> |
30 |
| - <?php foreach ($_review->getRatingVotes() as $_vote): ?> |
31 |
| - <div class="rating-summary item" |
32 |
| - itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> |
33 |
| - <span class="label rating-label"> |
34 |
| - <span><?= $block->escapeHtml($_vote->getRatingCode()) ?></span> |
35 |
| - </span> |
36 |
| - <div class="rating-result" |
37 |
| - id="review_<?= /* @noEscape */ $_review->getReviewId() |
38 |
| - ?>_vote_<?= /* @noEscape */ $_vote->getVoteId() ?>" |
39 |
| - title="<?= $block->escapeHtmlAttr($_vote->getPercent()) ?>%"> |
40 |
| - <meta itemprop="worstRating" content = "1"/> |
41 |
| - <meta itemprop="bestRating" content = "100"/> |
42 |
| - <span> |
43 |
| - <span itemprop="ratingValue"><?= $block->escapeHtml($_vote->getPercent()) ?>%</span> |
44 |
| - </span> |
| 21 | + <div class="block review-list" id="customer-reviews"> |
| 22 | + <?php if (!$block->getHideTitle()): ?> |
| 23 | + <div class="block-title"> |
| 24 | + <strong><?= $escaper->escapeHtml(__('Customer Reviews')) ?></strong> |
| 25 | + </div> |
| 26 | + <?php endif ?> |
| 27 | + <div class="block-content"> |
| 28 | + <div class="toolbar review-toolbar"> |
| 29 | + <?= $block->getChildHtml('toolbar') ?> |
| 30 | + </div> |
| 31 | + <ol class="items review-items"> |
| 32 | + <?php foreach ($_items as $_review): ?> |
| 33 | + <li class="item review-item" itemscope itemprop="review" itemtype="http://schema.org/Review"> |
| 34 | + <div class="review-title" itemprop="name"> |
| 35 | + <?= $escaper->escapeHtml($_review->getTitle()) ?> |
| 36 | + </div> |
| 37 | + <?php if (count($_review->getRatingVotes())): ?> |
| 38 | + <div class="review-ratings"> |
| 39 | + <?php foreach ($_review->getRatingVotes() as $_vote): ?> |
| 40 | + <div class="rating-summary item" |
| 41 | + itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> |
| 42 | + <span class="label rating-label"> |
| 43 | + <span><?= $escaper->escapeHtml($_vote->getRatingCode()) ?></span> |
| 44 | + </span> |
| 45 | + <div class="rating-result" |
| 46 | + id="review_<?= /* @noEscape */ $_review->getReviewId() |
| 47 | + . '_vote_' |
| 48 | + . $_vote->getVoteId() ?>" |
| 49 | + title="<?= $escaper->escapeHtmlAttr($_vote->getPercent()) ?>%"> |
| 50 | + <meta itemprop="worstRating" content="1"/> |
| 51 | + <meta itemprop="bestRating" content="100"/> |
| 52 | + <span> |
| 53 | + <span itemprop="ratingValue"> |
| 54 | + <?= $escaper->escapeHtml($_vote->getPercent()) ?>% |
| 55 | + </span> |
| 56 | + </span> |
| 57 | + </div> |
| 58 | + <?= /* @noEscape */ $secureRenderer->renderStyleAsTag( |
| 59 | + 'width:' . $_vote->getPercent() . '%', |
| 60 | + 'div#review_' . $_review->getReviewId() |
| 61 | + . '_vote_' . $_vote->getVoteId() . ' span' |
| 62 | + ) ?> |
| 63 | + </div> |
| 64 | + <?php endforeach; ?> |
| 65 | + </div> |
| 66 | + <?php endif; ?> |
| 67 | + <div class="review-content-container"> |
| 68 | + <div class="review-content" itemprop="description"> |
| 69 | + <?= /* @noEscape */ nl2br($escaper->escapeHtml($_review->getDetail())) ?> |
| 70 | + </div> |
| 71 | + <div class="review-details"> |
| 72 | + <p class="review-author"> |
| 73 | + <span class="review-details-label"> |
| 74 | + <?= $escaper->escapeHtml(__('Review by')) ?> |
| 75 | + </span> |
| 76 | + <strong class="review-details-value" itemprop="author"> |
| 77 | + <?= $escaper->escapeHtml($_review->getNickname()) ?> |
| 78 | + </strong> |
| 79 | + </p> |
| 80 | + <p class="review-date"> |
| 81 | + <span class="review-details-label"> |
| 82 | + <?= $escaper->escapeHtml(__('Posted on')) ?> |
| 83 | + </span> |
| 84 | + <time class="review-details-value" itemprop="datePublished" |
| 85 | + datetime="<?= $escaper->escapeHtmlAttr($block->formatDate( |
| 86 | + $_review->getCreatedAt(), |
| 87 | + $format |
| 88 | + )) ?>"> |
| 89 | + <?= $escaper->escapeHtml( |
| 90 | + $block->formatDate( |
| 91 | + $_review->getCreatedAt(), |
| 92 | + $format |
| 93 | + ) |
| 94 | + ) ?> |
| 95 | + </time> |
| 96 | + </p> |
| 97 | + </div> |
45 | 98 | </div>
|
46 |
| - <?= /* @noEscape */ $secureRenderer->renderStyleAsTag( |
47 |
| - 'width:' . $_vote->getPercent() . '%', |
48 |
| - 'div#review_' . $_review->getReviewId() . '_vote_' . $_vote->getVoteId() . ' span' |
49 |
| - ) ?> |
50 |
| - </div> |
51 |
| - <?php endforeach; ?> |
52 |
| - </div> |
53 |
| - <?php endif; ?> |
54 |
| - <div class="review-content" itemprop="description"> |
55 |
| - <?= /* @noEscape */ nl2br($block->escapeHtml($_review->getDetail())) ?> |
56 |
| - </div> |
57 |
| - <div class="review-details"> |
58 |
| - <p class="review-author"> |
59 |
| - <span class="review-details-label"><?= $block->escapeHtml(__('Review by')) ?></span> |
60 |
| - <strong class="review-details-value" |
61 |
| - itemprop="author"><?= $block->escapeHtml($_review->getNickname()) ?></strong> |
62 |
| - </p> |
63 |
| - <p class="review-date"> |
64 |
| - <span class="review-details-label"><?= $block->escapeHtml(__('Posted on')) ?></span> |
65 |
| - <time class="review-details-value" |
66 |
| - itemprop="datePublished" |
67 |
| - datetime="<?= $block->escapeHtmlAttr($block->formatDate( |
68 |
| - $_review->getCreatedAt(), |
69 |
| - $format |
70 |
| - )) ?>"><?= $block->escapeHtml($block->formatDate($_review->getCreatedAt(), $format)) ?> |
71 |
| - </time> |
72 |
| - </p> |
73 |
| - </div> |
74 |
| - </li> |
75 |
| - <?php endforeach; ?> |
76 |
| - </ol> |
77 |
| - <div class="toolbar review-toolbar"> |
78 |
| - <?= $block->getChildHtml('toolbar') ?> |
| 99 | + </li> |
| 100 | + <?php endforeach; ?> |
| 101 | + </ol> |
| 102 | + <div class="toolbar review-toolbar"> |
| 103 | + <?= $block->getChildHtml('toolbar') ?> |
| 104 | + </div> |
79 | 105 | </div>
|
80 | 106 | </div>
|
81 |
| -</div> |
82 |
| -<?php endif;?> |
| 107 | +<?php endif; ?> |
0 commit comments