Is there a user interface or software system for using the Preferred Widget feature that is part of the Magento CMS page page?
When adding a widget to the CMS page, the code that displays this widget is in the processing class of the template directive. This code
File: app/code/core/Mage/Widget/Model/Template/Filter.php class Mage_Adminhtml_Cms_PageController extends Mage_Adminhtml_Controller_Action { ... }
When loading widget parameters, there is the following bit of code
// validate required parameter type or id if (!empty($params['type'])) { $type = $params['type']; } elseif (!empty($params['id'])) { $preconfigured = Mage::getResourceSingleton('widget/widget') ->loadPreconfiguredWidget($params['id']); $type = $preconfigured['type']; $params = $preconfigured['parameters']; } else { return ''; }
This code shows the parsing of a widget directive tag for an id value
{{widget name="foobazbar" id=""}}
and then load the configuration from the widget model
public function loadPreconfiguredWidget($widgetId) { $read = $this->_getReadAdapter(); $select = $read->select(); $select->from($this->getMainTable()) ->where($this->getIdFieldName() . ' = ?', $widgetId); var_dump((string)$select); $widget = $read->fetchRow($select); if (is_array($widget)) { if ($widget['parameters']) { $widget['parameters'] = unserialize($widget['parameters']); } return $widget; } return false; }
When I first came across this code, I assumed that it loads the Widget instance model. However, it is not. Instead, it loads data from the widget/widget class, which corresponds to the widget table.
mysql> describe widget; +------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+------------------+------+-----+---------+----------------+ | widget_id | int(10) unsigned | NO | PRI | NULL | auto_increment | | code | varchar(255) | NO | MUL | NULL | | | type | varchar(255) | NO | | NULL | | | parameters | text | YES | | NULL | | +------------+------------------+------+-----+---------+----------------+
Is there a user interface or system to add data to this table? Does anyone (whether or not working at Magento Inc.) know if this is a supported feature, or if it is the beginning of something that was abandoned but left for backward compatibility reasons?