/** * Validate locale code. Code must be in the list of allowed locales. * * @param string $localeCode * @return bool * * @api */ public function isValid($localeCode) { $isValid = true; $allowedLocaleCodes = $this->_localeConfig->getAllowedLocales(); if (!$localeCode || !in_array($localeCode, $allowedLocaleCodes)) { $isValid = false; } return $isValid; }
/** * Retrieve array of allowed currencies * * @return array */ protected function _getAllowedCurrencies() { if ($this->_appState->isInstalled()) { $allowed = $this->_scopeResolver->getScope()->getAllowedCurrencies(); } else { $allowed = $this->_config->getAllowedCurrencies(); } return $allowed; }
/** * @inheritdoc */ public function getOptionCurrencies() { $currencies = $this->getTranslationList('currencytoname'); $options = array(); $allowed = $this->_config->getAllowedCurrencies(); foreach ($currencies as $name => $code) { if (!in_array($code, $allowed)) { continue; } $options[] = array('label' => $name, 'value' => $code); } return $this->_sortOptionArray($options); }
/** * @inheritdoc */ public function getOptionCurrencies() { $currencies = (new CurrencyBundle())->get($this->localeResolver->getLocale())['Currencies'] ?: []; $options = []; $allowed = $this->_config->getAllowedCurrencies(); foreach ($currencies as $code => $data) { if (!in_array($code, $allowed)) { continue; } $options[] = ['label' => $data[1], 'value' => $code]; } return $this->_sortOptionArray($options); }
/** * @param ConfigInterface $localeConfig */ public function __construct(ConfigInterface $localeConfig) { $this->allowedLocales = $localeConfig->getAllowedLocales(); }
/** * Constructor * * @param Zend_Locale $zendLocale * @param ConfigInterface $localeConfig */ public function __construct(Zend_Locale $zendLocale, ConfigInterface $localeConfig) { $this->zendLocale = $zendLocale; $this->allowedLocales = $localeConfig->getAllowedLocales(); }