Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Widget.php
Go to the documentation of this file.
1 <?php
8 
15 {
21  protected function _construct()
22  {
23  $this->_init('widget', 'widget_id');
24  }
25 
32  public function loadPreconfiguredWidget($widgetId)
33  {
34  $connection = $this->getConnection();
35  $select = $connection->select()->from(
36  $this->getMainTable()
37  )->where(
38  $this->getIdFieldName() . '=:' . $this->getIdFieldName()
39  );
40  $bind = [$this->getIdFieldName() => $widgetId];
41  $widget = $connection->fetchRow($select, $bind);
42  if (is_array($widget)) {
43  if ($widget['parameters']) {
44  $widget['parameters'] = $this->getSerializer()->unserialize($widget['parameters']);
45  }
46  return $widget;
47  }
48  return false;
49  }
50 }
$connection
Definition: bulk.php:13