Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-braintree
Model
Adminhtml
System
Config
Country.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Braintree\Model\Adminhtml\System\Config
;
7
8
use
Magento\Directory\Model\ResourceModel\Country\Collection
;
9
use
Magento\Framework\Option\ArrayInterface
;
10
14
class
Country
implements
ArrayInterface
15
{
19
protected
$options
;
20
26
protected
$countryCollection
;
27
31
protected
$excludedCountries
= [
32
'MM'
,
33
'IR'
,
34
'SD'
,
35
'BY'
,
36
'CI'
,
37
'CD'
,
38
'CG'
,
39
'IQ'
,
40
'LR'
,
41
'LB'
,
42
'KP'
,
43
'SL'
,
44
'SY'
,
45
'ZW'
,
46
'AL'
,
47
'BA'
,
48
'MK'
,
49
'ME'
,
50
'RS'
51
];
52
56
public
function
__construct
(
Collection
$countryCollection
)
57
{
58
$this->countryCollection =
$countryCollection
;
59
}
60
65
public
function
toOptionArray
($isMultiselect =
false
)
66
{
67
if
(!$this->options) {
68
$this->options = $this->countryCollection
69
->addFieldToFilter(
'country_id'
, [
'nin'
=> $this->
getExcludedCountries
()])
70
->loadData()
71
->toOptionArray(
false
);
72
}
73
74
$options
=
$this->options
;
75
if
(!$isMultiselect) {
76
array_unshift(
$options
, [
'value'
=>
''
,
'label'
=>
__
(
'--Please Select--'
)]);
77
}
78
79
return
$options
;
80
}
81
88
public
function
isCountryRestricted
($countryId)
89
{
90
return
in_array($countryId, $this->
getExcludedCountries
());
91
}
92
97
public
function
getExcludedCountries
()
98
{
99
return
$this->excludedCountries
;
100
}
101
}
Magento\Braintree\Model\Adminhtml\System\Config
Definition:
CountryCreditCardTest.php:7
Magento\Directory\Model\ResourceModel\Country\Collection
Definition:
Collection.php:21
Magento\Braintree\Model\Adminhtml\System\Config\Country\$countryCollection
$countryCollection
Definition:
Country.php:26
__
__()
Definition:
__.php:13
Magento\Framework\Option\ArrayInterface
Definition:
ArrayInterface.php:11
Magento\Braintree\Model\Adminhtml\System\Config\Country\getExcludedCountries
getExcludedCountries()
Definition:
Country.php:97
Magento\Braintree\Model\Adminhtml\System\Config\Country
Definition:
Country.php:14
Magento\Braintree\Model\Adminhtml\System\Config\Country\$excludedCountries
$excludedCountries
Definition:
Country.php:31
Magento\Braintree\Model\Adminhtml\System\Config\Country\isCountryRestricted
isCountryRestricted($countryId)
Definition:
Country.php:88
Magento\Braintree\Model\Adminhtml\System\Config\Country\toOptionArray
toOptionArray($isMultiselect=false)
Definition:
Country.php:65
Magento\Braintree\Model\Adminhtml\System\Config\Country\__construct
__construct(Collection $countryCollection)
Definition:
Country.php:56
Magento\Braintree\Model\Adminhtml\System\Config\Country\$options
$options
Definition:
Country.php:19