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-directory
Model
Config
Source
Country.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Directory\Model\Config\Source
;
7
14
class
Country
implements
\Magento\Framework\Option\ArrayInterface
15
{
21
protected
$_countryCollection
;
22
28
protected
$_options
;
29
33
public
function
__construct
(\
Magento
\Directory\Model\
ResourceModel
\
Country
\Collection $countryCollection)
34
{
35
$this->_countryCollection = $countryCollection;
36
}
37
45
public
function
toOptionArray
($isMultiselect =
false
, $foregroundCountries =
''
)
46
{
47
if
(!$this->_options) {
48
$this->_options = $this->_countryCollection->loadData()->setForegroundCountries(
49
$foregroundCountries
50
)->toOptionArray(
51
false
52
);
53
}
54
55
$options
=
$this->_options
;
56
if
(!$isMultiselect) {
57
array_unshift(
$options
, [
'value'
=>
''
,
'label'
=>
__
(
'--Please Select--'
)]);
58
}
59
60
return
$options
;
61
}
62
}
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
Magento\Directory\Model\Config\Source\Country\__construct
__construct(\Magento\Directory\Model\ResourceModel\Country\Collection $countryCollection)
Definition:
Country.php:33
__
__()
Definition:
__.php:13
Magento\Framework\Option\ArrayInterface
Definition:
ArrayInterface.php:11
Magento\Directory\Model\Config\Source\Country\$_countryCollection
$_countryCollection
Definition:
Country.php:21
Magento\Directory\Model\Config\Source
Definition:
Allregion.php:6
Magento
Magento\Directory\Model\Config\Source\Country\toOptionArray
toOptionArray($isMultiselect=false, $foregroundCountries='')
Definition:
Country.php:45
Magento\Directory\Model\Config\Source\Country\$_options
$_options
Definition:
Country.php:28
Magento\Directory\Model\Config\Source\Country
Definition:
Country.php:14
$options
$options
Definition:
multiple_mixed_products.php:29