Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Website.php
Go to the documentation of this file.
1 <?php
7 
13 {
17  protected $_options;
18 
22  protected $_storeManager;
23 
28  {
29  $this->_storeManager = $storeManager;
30  }
31 
35  public function toOptionArray()
36  {
37  if (!$this->_options) {
38  $this->_options = [];
39  foreach ($this->_storeManager->getWebsites() as $website) {
40  $id = $website->getId();
41  $name = $website->getName();
42  if ($id != 0) {
43  $this->_options[] = ['value' => $id, 'label' => $name];
44  }
45  }
46  }
47  return $this->_options;
48  }
49 }
$id
Definition: fieldset.phtml:14
$storeManager
__construct(\Magento\Store\Model\StoreManagerInterface $storeManager)
Definition: Website.php:27
if(!isset($_GET['name'])) $name
Definition: log.php:14