![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-directory/Model/Config/Source/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Directory\Model\Config\Source; /** * Options provider for countries list * * @api * @since 100.0.2 */ class Country implements \Magento\Framework\Option\ArrayInterface { /** * Countries * * @var \Magento\Directory\Model\ResourceModel\Country\Collection */ protected $_countryCollection; /** * Options array * * @var array */ protected $_options; /** * @param \Magento\Directory\Model\ResourceModel\Country\Collection $countryCollection */ public function __construct(\Magento\Directory\Model\ResourceModel\Country\Collection $countryCollection) { $this->_countryCollection = $countryCollection; } /** * Return options array * * @param boolean $isMultiselect * @param string|array $foregroundCountries * @return array */ public function toOptionArray($isMultiselect = false, $foregroundCountries = '') { if (!$this->_options) { $this->_options = $this->_countryCollection->loadData()->setForegroundCountries( $foregroundCountries )->toOptionArray( false ); } $options = $this->_options; if (!$isMultiselect) { array_unshift($options, ['value' => '', 'label' => __('--Please Select--')]); } return $options; } }