Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
7 
15 class Config extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
16 {
20  protected $_optionsData;
21 
26  public function __construct(array $options)
27  {
28  $this->_optionsData = $options;
29  }
30 
37  public function getAllOptions()
38  {
39  if ($this->_options === null) {
40  $this->_options = [];
41 
42  if (empty($this->_optionsData)) {
43  throw new \Magento\Framework\Exception\LocalizedException(__('No options found.'));
44  }
45  foreach ($this->_optionsData as $option) {
46  $this->_options[] = ['value' => $option['value'], 'label' => __($option['label'])];
47  }
48  }
49 
50  return $this->_options;
51  }
52 }
__()
Definition: __.php:13