*/ class Mage_Widget_Block_Adminhtml_Widget_Form extends Mage_Adminhtml_Block_Widget_Form { /** * Form with widget to select */ protected function _prepareForm() { $form = new Varien_Data_Form(); $fieldset = $form->addFieldset('base_fieldset', array( 'legend' => $this->helper('widget')->__('Widget') )); $select = $fieldset->addField('select_widget_type', 'select', array( 'label' => $this->helper('widget')->__('Widget Type'), 'title' => $this->helper('widget')->__('Widget Type'), 'name' => 'widget_type', 'required' => true, 'options' => $this->_getWidgetSelectOptions(), 'after_element_html' => $this->_getWidgetSelectAfterHtml(), )); $form->setUseContainer(true); $form->setId('widget_options_form'); $form->setMethod('post'); $form->setAction($this->getUrl('*/*/buildWidget')); $this->setForm($form); } /** * Prepare options for widgets HTML select * * @return array */ protected function _getWidgetSelectOptions() { foreach ($this->_getAvailableWidgets(true) as $data) { $options[$data['type']] = $data['name']; } return $options; } /** * Prepare widgets select after element HTML * * @return string */ protected function _getWidgetSelectAfterHtml() { $html = '
'; $i = 0; foreach ($this->_getAvailableWidgets(true) as $data) { $html .= sprintf('