|
| __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) |
|
| displayPriceAttribute ($dataObject, $code, $strong=false, $separator='< br/>') |
|
| displayPrices ($dataObject, $basePrice, $price, $strong=false, $separator='< br/>') |
|
| applySalableProductTypesFilter ($collection) |
|
| escapeHtmlWithLinks ($data, $allowedTags=null) |
|
| __construct (Context $context) |
|
| isModuleOutputEnabled ($moduleName=null) |
|
Sales admin helper.
Definition at line 13 of file Admin.php.
◆ __construct()
- Parameters
-
\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 | |
Definition at line 42 of file Admin.php.
51 $this->_salesConfig = $salesConfig;
53 parent::__construct($context);
◆ applySalableProductTypesFilter()
applySalableProductTypesFilter |
( |
|
$collection | ) |
|
Filter collection by removing not available product types
- Parameters
-
\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection | $collection | |
- Returns
- \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
Definition at line 123 of file Admin.php.
125 $productTypes = $this->_salesConfig->getAvailableProductTypes();
elseif(isset( $params[ 'redirect_parent']))
◆ displayPriceAttribute()
displayPriceAttribute |
( |
|
$dataObject, |
|
|
|
$code, |
|
|
|
$strong = false , |
|
|
|
$separator = '<br/>' |
|
) |
| |
Display price attribute value in base order currency and in place order currency
- Parameters
-
\Magento\Framework\DataObject | $dataObject | |
string | $code | |
bool | $strong | |
string | $separator | |
- Returns
- string
Definition at line 65 of file Admin.php.
68 $baseValue = $dataObject->hasData(
'bs_' .
$code)
69 ? $dataObject->getData(
'bs_' .
$code)
70 : $dataObject->getData(
'base_' .
$code);
74 $dataObject->getData(
$code),
displayPrices($dataObject, $basePrice, $price, $strong=false, $separator='< br/>')
◆ displayPrices()
displayPrices |
( |
|
$dataObject, |
|
|
|
$basePrice, |
|
|
|
$price, |
|
|
|
$strong = false , |
|
|
|
$separator = '<br/>' |
|
) |
| |
Get "double" prices html (block with base and place currency)
- Parameters
-
\Magento\Framework\DataObject | $dataObject | |
float | $basePrice | |
float | $price | |
bool | $strong | |
string | $separator | |
- Returns
- string
Definition at line 90 of file Admin.php.
92 if ($dataObject instanceof \
Magento\Sales\Model\Order) {
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>';
elseif(isset( $params[ 'redirect_parent']))
◆ escapeHtmlWithLinks()
escapeHtmlWithLinks |
( |
|
$data, |
|
|
|
$allowedTags = null |
|
) |
| |
Escape string preserving links
- Parameters
-
string | $data | |
null | array | $allowedTags | |
- Returns
- string
Definition at line 150 of file Admin.php.
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);
◆ $_salesConfig
◆ $_storeManager
◆ $escaper
◆ $priceCurrency
The documentation for this class was generated from the following file: