<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** * @var \Magento\Review\Block\Product\ReviewRenderer $block * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer * @var \Magento\Framework\Escaper $escaper */ $url = $block->getReviewsUrl() . '#reviews'; $urlForm = $block->getReviewsUrl() . '#review-form'; ?> <?php if ($block->isReviewEnabled() && $block->getReviewsCount()): ?> <?php $rating = $block->getRatingSummary(); ?> <div class="product-reviews-summary<?= !$rating ? ' no-rating' : '' ?>" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><?php if ($rating):?> <div class="rating-summary"><span class="label"><span><?= $escaper->escapeHtml(__('Rating')) ?>:</span></span> <div class="rating-result" id="rating-result_<?= $escaper->escapeHtmlAttr($block->getProduct()->getId()) ?>" title="<?= $escaper->escapeHtmlAttr($rating); ?>%"><span style="width: <?= $escaper->escapeHtmlAttr($rating); ?>%;"><span> <span itemprop="ratingValue"><?= $escaper->escapeHtml($rating); ?></span>% of <span itemprop="bestRating">100</span></span></span></div></div><?php endif;?> <div class="reviews-actions"><a class="action view" href="<?= $escaper->escapeUrl($url) ?>"><span itemprop="reviewCount"><?= $escaper->escapeHtml($block->getReviewsCount()) ?></span>&nbsp; <span><?= ($block->getReviewsCount() == 1) ? $escaper->escapeHtml(__('Review')) : $escaper->escapeHtml(__('Reviews')) ?></span></a> <a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>"><?= $escaper->escapeHtml(__('Add Your Review')) ?></a></div></div><?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()): ?> <div class="product-reviews-summary empty"><div class="reviews-actions"><a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>"><?= $escaper->escapeHtml(__('Be the first to review this product')) ?></a></div></div><?php endif; ?>