我在magento中创建了一个包含文本框和编辑器的自定义模块。 但是当我尝试使用编辑器上传图像或视频时,它显示的错误就像是。
error: error in [unknown object].fireEvent():
event name: open_browser_callback
error message: MediabrowserUtility is not defined
因此,我无法在模块中上传任何图片或视频。
如何解决这个问题? 请帮助我..
答案 0 :(得分:2)
在您的config.xml中,您有:
<events>
<cms_wysiwyg_config_prepare>
<observers>
<variable_observer>
<class>core/variable_observer</class>
<method>prepareWysiwygPluginConfig</method>
</variable_observer>
</observers>
</cms_wysiwyg_config_prepare>
</events>
在Block / Adminhtml / WHATEVER / Edit.php
中protected function _prepareLayout() {
parent::_prepareLayout();
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
}
}
然后在Block / Adminhtml / WHATEVER / Edit / Tab / Form.php的顶部
protected function _prepareForm() {
$form = new Varien_Data_Form();
$this->setForm($form);
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false,
'add_widgets' => false,
'add_images' => true,
'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
'files_browser_window_height'=> (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height')
));
再向下:
$fieldset->addField('not-called-content', 'editor', array(
'name' => 'not-called-content',
'label' => Mage::helper('WHATEVER')->__('Content'),
'title' => Mage::helper('WHATEVER')->__('Content'),
'style' => 'width:550px; height:300px;',
'required' => false,
'config' => $wysiwygConfig,
'wysiwyg' => true
));
标准问题:不要将您所见即所得的区域称为“内容”。 Magento已经将其用于表单ID。