18 class Locale extends \Magento\Framework\App\Config\Value
65 \
Magento\Framework\
Data\Collection\AbstractDb $resourceCollection =
null,
68 $this->_configsFactory = $configsFactory;
69 $this->_websiteFactory = $websiteFactory;
70 $this->_storeFactory = $storeFactory;
71 $this->_localeCurrency = $localeCurrency;
85 $values = explode(
',', $this->getValue());
90 $scopeName =
__(
'Default scope');
92 if (preg_match(
'/(base|default)$/',
$data->getPath(), $match)) {
94 $currencyName = $this->_localeCurrency->getCurrency(
$data->getValue())->getName();
95 if ($match[1] ==
'base') {
96 $fieldName =
__(
'Base currency');
98 $fieldName =
__(
'Display default currency');
101 switch (
$data->getScope()) {
103 $scopeName =
__(
'Default scope');
106 case \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE:
108 $website = $this->_websiteFactory->create();
109 $websiteName =
$website->load(
$data->getScopeId())->getName();
110 $scopeName =
__(
'website(%1) scope', $websiteName);
113 case \Magento\Store\Model\ScopeInterface::SCOPE_STORE:
115 $store = $this->_storeFactory->create();
121 $exceptions[] =
__(
'Currency "%1" is used as %2 in %3.', $currencyName, $fieldName, $scopeName);
126 throw new \Magento\Framework\Exception\LocalizedException(
__(join(
"\n", $exceptions)));
129 return parent::afterSave();
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory $configsFactory, \Magento\Store\Model\WebsiteFactory $websiteFactory, \Magento\Store\Model\StoreFactory $storeFactory, \Magento\Framework\Locale\CurrencyInterface $localeCurrency, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])