Magento Admin使用表单字段创建HTML并将其保存到数据库

时间:2013-04-18 19:38:31

标签: html magento

我正在开发一个模块,需要输入一些html以便稍后调用,并成为面向客户的小部件输出的一部分。

我已经创建了一个管理后端,这一切都正常工作,但是当我在应该存储数据的字段中输入html时,我收到错误。 我不需要wysiwyg,但我希望能够输入html到这个值。

此时,在将字段添加到字段集时,我没有做任何特别的事情。我错过了什么?

    $contentField = $fieldset->addField('inner_html', 'editor', array(
        'name'      => 'inner_html',
        'style'     => 'height:36em;width:36em',
        'required'  => false,
    ));

1 个答案:

答案 0 :(得分:1)

尝试

$fieldset->addField('inner_html', 'editor', array( 
    'name' => 'inner_html', 
    'label' => Mage::helper('tag')->__('Description'), 
    'title' => Mage::helper('tag')->__('Description'), 
    'style' => 'width:700px; height:350px;', 
    'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false,'files_browser_window_url'=>$this->getBaseUrl().'admin/cms_wysiwyg_images/index/')), 
    'wysiwyg' => true, 
    'required' => false, 
));