Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
setup
src
Magento
Setup
Module
I18n
Parser
Contextual.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Setup\Module\I18n\Parser
;
7
8
use
Magento\Setup\Module\I18n
;
9
13
class
Contextual
extends
AbstractParser
14
{
20
protected
$_context
;
21
29
public
function
__construct
(I18n\
FilesCollector
$filesCollector, I18n\
Factory
$factory
, I18n\
Context
$context)
30
{
31
$this->_context = $context;
32
33
parent::__construct($filesCollector,
$factory
);
34
}
35
42
protected
function
_parseByTypeOptions
(
$options
)
43
{
44
foreach
($this->
_getFiles
(
$options
) as $file) {
45
$adapter
= $this->_adapters[
$options
[
'type'
]];
46
$adapter
->parse($file);
47
48
list($contextType, $contextValue) = $this->_context->getContextByPath($file);
49
50
foreach
(
$adapter
->getPhrases() as $phraseData) {
51
$this->_addPhrase($phraseData, $contextType, $contextValue);
52
}
53
}
54
}
55
64
protected
function
_addPhrase($phraseData, $contextType, $contextValue)
65
{
66
$phraseKey = $contextType . $contextValue. stripslashes($phraseData[
'phrase'
]);
67
68
if
(isset($this->_phrases[$phraseKey])) {
70
$phrase = $this->_phrases[$phraseKey];
71
$phrase->addContextValue($contextValue);
72
}
else
{
73
$this->_phrases[$phraseKey] = $this->_factory->createPhrase(
74
[
75
'phrase'
=> $phraseData[
'phrase'
],
76
'translation'
=> $phraseData[
'phrase'
],
77
'context_type'
=> $contextType,
78
'context_value'
=> [$contextValue],
79
'quote'
=> $phraseData[
'quote'
],
80
]
81
);
82
}
83
}
84
}
Magento\Setup\Module\I18n\Parser
Magento\Setup\Module\I18n\Parser\Contextual
Definition:
Contextual.php:13
Magento\Setup\Module\I18n
$adapter
$adapter
Definition:
webapi_user.php:16
Magento\Setup\Module\I18n\Parser\Contextual\_parseByTypeOptions
_parseByTypeOptions($options)
Definition:
Contextual.php:42
$factory
$factory
Definition:
category_multiple_stores.php:10
Magento\Setup\Module\I18n\Parser\AbstractParser\_getFiles
_getFiles($options)
Definition:
AbstractParser.php:118
Magento\Setup\Module\I18n\Parser\Contextual\__construct
__construct(I18n\FilesCollector $filesCollector, I18n\Factory $factory, I18n\Context $context)
Definition:
Contextual.php:29
Magento\Setup\Module\I18n\Context
Definition:
Context.php:15
Magento\Setup\Module\I18n\FilesCollector
Definition:
FilesCollector.php:11
Magento\Setup\Module\I18n\Factory
Definition:
Factory.php:11
$options
$options
Definition:
multiple_mixed_products.php:29
Magento\Setup\Module\I18n\Parser\AbstractParser
Definition:
AbstractParser.php:13
Magento\Setup\Module\I18n\Parser\Contextual\$_context
$_context
Definition:
Contextual.php:20