![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-review/Block/Product/View/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Review\Block\Product\View; /** * Detailed Product Reviews * * @api * @since 100.0.2 */ class ListView extends \Magento\Review\Block\Product\View { /** * Unused class property * @var false */ protected $_forceHasOptions = false; /** * Get product id * * @return int|null */ public function getProductId() { $product = $this->_coreRegistry->registry('product'); return $product ? $product->getId() : null; } /** * Prepare product review list toolbar * * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); $toolbar = $this->getLayout()->getBlock('product_review_list.toolbar'); if ($toolbar) { $toolbar->setCollection($this->getReviewsCollection()); $this->setChild('toolbar', $toolbar); } return $this; } /** * Add rate votes * * @return $this */ protected function _beforeToHtml() { if ($this->getProductId()) { $this->getReviewsCollection()->load()->addRateVotes(); } return parent::_beforeToHtml(); } /** * Return review url * * @param int $id * @return string */ public function getReviewUrl($id) { return $this->getUrl('*/*/view', ['id' => $id]); } }