|
| __construct (\Magento\Framework\App\Helper\Context $context, \Magento\Eav\Model\Config $eavConfig, Data $catalogData, \Magento\Framework\Escaper $escaper, $directivePatterns=[]) |
|
| addHandler ($method, $handler) |
|
| getHandlers ($method) |
|
| process ($method, $result, $params) |
|
| productAttribute ($product, $attributeHtml, $attributeName) |
|
| categoryAttribute ($category, $attributeHtml, $attributeName) |
|
| isDirectivesExists ($attributeHtml) |
|
| __construct (Context $context) |
|
| isModuleOutputEnabled ($moduleName=null) |
|
Definition at line 14 of file Output.php.
◆ __construct()
Output constructor.
- Parameters
-
\Magento\Framework\App\Helper\Context | $context | |
\Magento\Eav\Model\Config | $eavConfig | |
Data | $catalogData | |
\Magento\Framework\Escaper | $escaper | |
array | $directivePatterns | |
Definition at line 62 of file Output.php.
70 $this->_catalogData = $catalogData;
71 $this->_escaper = $escaper;
72 $this->directivePatterns = $directivePatterns;
73 parent::__construct($context);
◆ _getTemplateProcessor()
_getTemplateProcessor |
( |
| ) |
|
|
protected |
- Returns
- Template
Definition at line 79 of file Output.php.
81 if (
null === $this->_templateProcessor) {
82 $this->_templateProcessor = $this->_catalogData->getPageTemplateProcessor();
◆ addHandler()
addHandler |
( |
|
$method, |
|
|
|
$handler |
|
) |
| |
Adding method handler
- Parameters
-
string | $method | |
object | $handler | |
- Returns
- $this
Definition at line 95 of file Output.php.
102 if (!isset($this->_handlers[
$method])) {
103 $this->_handlers[
$method] = [];
catch(\Exception $e) $handler
◆ categoryAttribute()
categoryAttribute |
( |
|
$category, |
|
|
|
$attributeHtml, |
|
|
|
$attributeName |
|
) |
| |
Prepare category attribute html output
- Parameters
-
ModelCategory | $category | |
string | $attributeHtml | |
string | $attributeName | |
- Returns
- string
- Exceptions
-
Definition at line 192 of file Output.php.
194 $attribute = $this->_eavConfig->getAttribute(ModelCategory::ENTITY, $attributeName);
201 $attributeHtml = $this->_escaper->escapeHtml($attributeHtml);
203 if ($attributeHtml !==
null 211 $attributeHtml = $this->
process(
214 [
'category' =>
$category,
'attribute' => $attributeName]
216 return $attributeHtml;
process($method, $result, $params)
isDirectivesExists($attributeHtml)
◆ getHandlers()
Get all handlers for some method
- Parameters
-
- Returns
- array
Definition at line 116 of file Output.php.
119 return $this->_handlers[
$method] ?? [];
◆ isDirectivesExists()
isDirectivesExists |
( |
|
$attributeHtml | ) |
|
Check if string has directives
- Parameters
-
- Returns
- bool
Definition at line 225 of file Output.php.
228 foreach ($this->directivePatterns as
$pattern) {
229 if (preg_match(
$pattern, $attributeHtml)) {
◆ process()
process |
( |
|
$method, |
|
|
|
$result, |
|
|
|
$params |
|
) |
| |
Process all method handlers
- Parameters
-
string | $method | |
mixed | $result | |
array | $params | |
- Returns
- mixed
Definition at line 130 of file Output.php.
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
catch(\Exception $e) $handler
◆ productAttribute()
productAttribute |
( |
|
$product, |
|
|
|
$attributeHtml, |
|
|
|
$attributeName |
|
) |
| |
Prepare product attribute html output
- Parameters
-
ModelProduct | $product | |
string | $attributeHtml | |
string | $attributeName | |
- Returns
- string @SuppressWarnings(PHPMD.CyclomaticComplexity)
- Exceptions
-
Definition at line 150 of file Output.php.
152 $attribute = $this->_eavConfig->getAttribute(ModelProduct::ENTITY, $attributeName);
155 $attribute->getFrontendInput() !=
'media_image' &&
159 if (
$attribute->getFrontendInput() !=
'price') {
160 $attributeHtml = $this->_escaper->escapeHtml($attributeHtml);
162 if (
$attribute->getFrontendInput() ==
'textarea') {
163 $attributeHtml = nl2br($attributeHtml);
166 if ($attributeHtml !==
null 174 $attributeHtml = $this->
process(
177 [
'product' =>
$product,
'attribute' => $attributeName]
180 return $attributeHtml;
process($method, $result, $params)
isDirectivesExists($attributeHtml)
◆ $_catalogData
◆ $_eavConfig
◆ $_escaper
◆ $_handlers
◆ $_templateProcessor
$_templateProcessor = null |
|
protected |
The documentation for this class was generated from the following file: