133 \
Magento\Framework\
App\Config\ScopeConfigInterface $scopeConfig,
134 \
Magento\Framework\
App\Config\ReinitableConfigInterface $coreConfig,
139 \
Magento\Store\Model\System\Store $systemStore,
140 \
Magento\Framework\Event\ManagerInterface $eventManager,
141 Json $serializer =
null 143 $this->_coreConfig = $coreConfig;
148 $this->_systemStore = $systemStore;
149 $this->_eventManager = $eventManager;
150 $this->_scopeConfig = $scopeConfig;
161 if ($this->_symbolsData) {
165 $this->_symbolsData = [];
169 foreach ($this->getAllowedCurrencies() as
$code) {
170 $currencies = (
new CurrencyBundle())->
get($this->localeResolver->getLocale())[
'Currencies'];
173 $this->_symbolsData[
$code] = [
'parentSymbol' => $symbol,
'displayName' =>
$name];
175 if (isset($currentSymbols[
$code]) && !empty($currentSymbols[
$code])) {
176 $this->_symbolsData[
$code][
'displaySymbol'] = $currentSymbols[
$code];
178 $this->_symbolsData[
$code][
'displaySymbol'] = $this->_symbolsData[
$code][
'parentSymbol'];
180 $this->_symbolsData[
$code][
'inherited'] =
181 ($this->_symbolsData[
$code][
'parentSymbol'] == $this->_symbolsData[
$code][
'displaySymbol']);
197 unset($symbols[
$code]);
202 $value[
'options'][
'fields'][
'customsymbol'][
'value'] = $this->serializer->serialize($symbols);
204 $value[
'options'][
'fields'][
'customsymbol'][
'inherit'] = 1;
207 $this->_configFactory->create()
208 ->setSection(self::CONFIG_SECTION)
214 $this->_eventManager->dispatch(
215 'admin_system_config_changed_section_currency_before_reinit',
216 [
'website' => $this->_websiteId,
'store' => $this->_storeId]
220 $this->_coreConfig->reinit();
224 $this->_symbolsData = [];
226 $this->_eventManager->dispatch(
227 'admin_system_config_changed_section_currency',
228 [
'website' => $this->_websiteId,
'store' => $this->_storeId]
243 if (array_key_exists(
$code, $customSymbols)) {
244 return $customSymbols[
$code];
258 foreach ($this->_cacheTypes as $cacheType) {
259 $this->_cacheTypeList->invalidate($cacheType);
274 $configData = (string)$this->_scopeConfig->getValue(
276 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
291 protected function getAllowedCurrencies()
293 $allowedCurrencies = explode(
294 self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR,
295 $this->_scopeConfig->getValue(
296 self::XML_PATH_ALLOWED_CURRENCIES,
297 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
304 foreach ($storeModel->getWebsiteCollection() as
$website) {
305 $websiteShow =
false;
307 foreach ($storeModel->getGroupCollection() as
$group) {
312 foreach ($storeModel->getStoreCollection() as
$store) {
318 $websiteSymbols =
$website->getConfig(self::XML_PATH_ALLOWED_CURRENCIES);
319 $allowedCurrencies = array_merge(
321 explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $websiteSymbols)
324 $storeSymbols = $this->_scopeConfig->getValue(
325 self::XML_PATH_ALLOWED_CURRENCIES,
326 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
329 $allowedCurrencies = array_merge(
331 explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $storeSymbols)
336 return array_unique($allowedCurrencies);
setCurrencySymbolsData($symbols=[])
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Config\ReinitableConfigInterface $coreConfig, \Magento\Config\Model\Config\Factory $configFactory, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Store\Model\System\Store $systemStore, \Magento\Framework\Event\ManagerInterface $eventManager, Json $serializer=null)
_unserializeStoreConfig($configPath, $storeId=null)
const XML_PATH_ALLOWED_CURRENCIES
const ALLOWED_CURRENCIES_CONFIG_SEPARATOR
const XML_PATH_CURRENCY_ALLOW
const XML_PATH_CUSTOM_CURRENCY_SYMBOL
if(!isset($_GET['name'])) $name