mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 17:27:36 +00:00
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
|
|
namespace Magento\Widget\Model\ResourceModel;
|
|
|
|
/**
|
|
* Resource model for widget.
|
|
*
|
|
* @deprecated 101.0.0 Data from this table was moved to xml(widget.xml).
|
|
*/
|
|
class Widget extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
|
|
{
|
|
/**
|
|
* Define main table
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function _construct()
|
|
{
|
|
$this->_init('widget', 'widget_id');
|
|
}
|
|
|
|
/**
|
|
* Retrieves pre-configured parameters for widget
|
|
*
|
|
* @param int $widgetId
|
|
* @return array|false
|
|
*/
|
|
public function loadPreconfiguredWidget($widgetId)
|
|
{
|
|
$connection = $this->getConnection();
|
|
$select = $connection->select()->from(
|
|
$this->getMainTable()
|
|
)->where(
|
|
$this->getIdFieldName() . '=:' . $this->getIdFieldName()
|
|
);
|
|
$bind = [$this->getIdFieldName() => $widgetId];
|
|
$widget = $connection->fetchRow($select, $bind);
|
|
if (is_array($widget)) {
|
|
if ($widget['parameters']) {
|
|
$widget['parameters'] = $this->getSerializer()->unserialize($widget['parameters']);
|
|
}
|
|
return $widget;
|
|
}
|
|
return false;
|
|
}
|
|
}
|