![]() 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/cartforge.co/vendor/magento/module-catalog/Pricing/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Catalog\Pricing; use Magento\Catalog\Model\Product; use Magento\Framework\Pricing\SaleableInterface; use Magento\Framework\Pricing\Render as PricingRender; use Magento\Framework\Registry; use Magento\Framework\View\Element\Template; /** * Catalog Price Render * * @api * @method string getPriceRender() * @method string getPriceTypeCode() * @since 100.0.2 */ class Render extends Template { /** * @var \Magento\Framework\Registry */ protected $registry; /** * Construct * * @param Template\Context $context * @param Registry $registry * @param array $data */ public function __construct( Template\Context $context, Registry $registry, array $data = [] ) { $this->registry = $registry; parent::__construct($context, $data); } /** * Produce and return block's html output * * @return string */ protected function _toHtml() { /** @var PricingRender $priceRender */ $priceRender = $this->getLayout()->getBlock($this->getPriceRender()); if ($priceRender instanceof PricingRender) { $product = $this->getProduct(); if ($product instanceof SaleableInterface) { $arguments = $this->getData(); $arguments['render_block'] = $this; return $priceRender->render($this->getPriceTypeCode(), $product, $arguments); } } return parent::_toHtml(); } /** * Returns saleable item instance * * @return Product */ protected function getProduct() { $parentBlock = $this->getParentBlock(); $product = $parentBlock && $parentBlock->getProductItem() ? $parentBlock->getProductItem() : $this->registry->registry('product'); return $product; } }