Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Types.php
Go to the documentation of this file.
1 <?php
8 
13 {
17  protected $_model;
18 
22  public function __construct(\Magento\Widget\Model\Widget\Instance $widgetInstanceModel)
23  {
24  $this->_model = $widgetInstanceModel;
25  }
26 
30  public function toOptionArray()
31  {
32  $widgets = [];
33  $widgetsOptionsArr = $this->_model->getWidgetsOptionArray('type');
34  foreach ($widgetsOptionsArr as $widget) {
35  $widgets[$widget['value']] = $widget['label'];
36  }
37  return $widgets;
38  }
39 }
__construct(\Magento\Widget\Model\Widget\Instance $widgetInstanceModel)
Definition: Types.php:22