Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractCurrency.php
Go to the documentation of this file.
1 <?php
15 
20 abstract class AbstractCurrency extends \Magento\Framework\App\Config\Value
21 {
27  protected function _getAllowedCurrencies()
28  {
29  if (!$this->isFormData() || $this->getData('groups/options/fields/allow/inherit')) {
30  return explode(
31  ',',
32  (string)$this->_config->getValue(
33  \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW,
34  $this->getScope(),
35  $this->getScopeId()
36  )
37  );
38  }
39 
40  return (array)$this->getData('groups/options/fields/allow/value');
41  }
42 
48  protected function _getInstalledCurrencies()
49  {
50  return explode(
51  ',',
52  $this->_config->getValue(
53  'system/currency/installed',
54  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
55  )
56  );
57  }
58 
64  protected function _getCurrencyBase()
65  {
66  $value = $this->getData('groups/options/fields/base/value');
67  if (!$this->isFormData() || !$value) {
68  $value = $this->_config->getValue(
69  \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
70  $this->getScope(),
71  $this->getScopeId()
72  );
73  }
74  return (string)$value;
75  }
76 
82  protected function _getCurrencyDefault()
83  {
84  if (!$this->isFormData() || !($value = $this->getData('groups/options/fields/default/value'))) {
85  $value = $this->_config->getValue(
86  \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT,
87  $this->getScope(),
88  $this->getScopeId()
89  );
90  }
91  return (string)$value;
92  }
93 
99  private function isFormData()
100  {
101  return $this->getData('groups/options/fields') !== null;
102  }
103 }
getData($key='', $index=null)
Definition: DataObject.php:119
$value
Definition: gender.phtml:16