6 declare(strict_types=1);
51 $this->_salesConfig = $salesConfig;
53 parent::__construct($context);
68 $baseValue = $dataObject->hasData(
'bs_' .
$code)
69 ? $dataObject->getData(
'bs_' .
$code)
70 : $dataObject->getData(
'base_' .
$code);
74 $dataObject->getData(
$code),
95 $order = $dataObject->getOrder();
100 $res .=
$order->formatBasePrice($basePrice);
101 $res .=
'</strong>' . $separator;
106 $res =
'<strong>' . $res .
'</strong>';
109 $res = $this->priceCurrency->format(
$price);
111 $res =
'<strong>' . $res .
'</strong>';
125 $productTypes = $this->_salesConfig->getAvailableProductTypes();
152 if (!empty(
$data) && is_array($allowedTags) && in_array(
'a', $allowedTags)) {
157 .
"(?:(?:\s+(?:(?:href\s*=\s*(['\"])(?<link>.*?)\\1\s*)|(?:\S+\s*=\s*(['\"])(.*?)\\3)\s*)*)|>)" 158 .
">?(?:(?:(?<text>.*?)(?:<\/a\s*>?|(?=<\w))|(?<text>.*)))#si";
159 while (preg_match($regexp,
$data, $matches)) {
161 if (!empty($matches[
'text'])) {
162 $text = str_replace(
'%%',
'%', $matches[
'text']);
164 $url = $this->filterUrl($matches[
'link'] ??
'');
167 '<a href="%s">%s</a>',
168 htmlspecialchars(
$url, ENT_QUOTES,
'UTF-8',
false),
169 $this->escaper->escapeHtml(
$text)
171 $data = str_replace($matches[0],
'%' .
$i .
'$s',
$data);
174 $data = $this->escaper->escapeHtml(
$data, $allowedTags);
177 return $this->escaper->escapeHtml(
$data, $allowedTags);
186 private function filterUrl(
string $url): string
190 $url = str_replace(
'%%',
'%',
$url);
191 $urlScheme = parse_url(
$url, PHP_URL_SCHEME);
192 $urlScheme = $urlScheme ? strtolower($urlScheme) :
'';
193 if ($urlScheme !==
'http' && $urlScheme !==
'https') {
elseif(isset( $params[ 'redirect_parent']))
escapeHtmlWithLinks($data, $allowedTags=null)
displayPriceAttribute($dataObject, $code, $strong=false, $separator='< br/>')
displayPrices($dataObject, $basePrice, $price, $strong=false, $separator='< br/>')
__construct(\Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Config $salesConfig, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, \Magento\Framework\Escaper $escaper)
applySalableProductTypesFilter($collection)