Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BuyerCountry.php
Go to the documentation of this file.
1 <?php
7 
12 {
16  protected $_configFactory;
17 
22 
27  public function __construct(
28  \Magento\Paypal\Model\ConfigFactory $configFactory,
29  \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
30  ) {
31  $this->_configFactory = $configFactory;
32  $this->_countryCollectionFactory = $countryCollectionFactory;
33  }
34 
38  public function toOptionArray($isMultiselect = false)
39  {
40  $supported = $this->_configFactory->create()->getSupportedBuyerCountryCodes();
41  $options = $this->_countryCollectionFactory->create()->addCountryCodeFilter(
42  $supported,
43  'iso2'
44  )->loadData()->toOptionArray(
45  $isMultiselect ? false : __('--Please Select--')
46  );
47 
48  return $options;
49  }
50 }
__construct(\Magento\Paypal\Model\ConfigFactory $configFactory, \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory)
__()
Definition: __.php:13
$configFactory
Definition: config_data.php:43