Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Timezone.php
Go to the documentation of this file.
1 <?php
11 
17 {
21  protected $ignoredTimezones = [
22  'Antarctica/Troll',
23  'Asia/Chita',
24  'Asia/Srednekolymsk',
25  'Pacific/Bougainville'
26  ];
27 
31  protected $_localeLists;
32 
36  public function __construct(\Magento\Framework\Locale\ListsInterface $localeLists)
37  {
38  $this->_localeLists = $localeLists;
39  }
40 
44  public function toOptionArray()
45  {
46  $timezones = $this->_localeLists->getOptionTimezones();
47  $timezones = array_filter($timezones, function ($value) {
48  if (in_array($value['value'], $this->ignoredTimezones)) {
49  return false;
50  }
51  return true;
52  });
53 
54  return $timezones;
55  }
56 }
$value
Definition: gender.phtml:16
__construct(\Magento\Framework\Locale\ListsInterface $localeLists)
Definition: Timezone.php:36