/** * {@inheritdoc} */ public function getList($locale = null) { if ($this->countryRepository) { $countryNames = $this->countryRepository->getList($locale); } else { $locale = $this->canonicalizeLocale($locale); $countryNames = $this->regionBundle->getCountryNames($locale); } return $countryNames; }
/** * {@inheritdoc} */ public function getList($locale = null) { if ($this->countryRepository) { $countryNames = $this->countryRepository->getList($locale); } else { $locale = LocaleHelper::canonicalize($locale); // symfony/intl uses underscores. $locale = str_replace('-', '_', $locale); $countryNames = $this->regionBundle->getCountryNames($locale); } return $countryNames; }
/** * Creates a CountryRepository instance. * * @param \Drupal\Core\Cache\CacheBackendInterface $cache * The cache backend. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. */ public function __construct(CacheBackendInterface $cache, LanguageManagerInterface $language_manager) { $this->cache = $cache; $this->languageManager = $language_manager; parent::__construct(); }
/** * {@inheritdoc} */ public function importByCountry($countryCode) { $countryRepository = new CountryRepository(); $country = $countryRepository->get($countryCode); $currencyCode = $country->getCurrencyCode(); $entity = NULL; if ($currencyCode) { $entity = $this->import($currencyCode); } return $entity; }