To enable the editor for a certain editable textfield, just use 'wysiwyg' => true, instead of 'wysiwyg' => false. and add 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(). i.e.:
$fieldset->addField('description', 'editor', array( 'name' => 'description', 'label' => Mage::helper('sevents')->__('Description'), 'title' => Mage::helper('sevents')->__('Description'), 'style' => 'height:12em;width:500px;', 'wysiwyg' => false, 'required' => true, ));
After Change
$fieldset->addField('description', 'editor', array( 'name' => 'description', 'label' => Mage::helper('sevents')->__('Description'), 'title' => Mage::helper('sevents')->__('Description'), 'style' => 'height:12em;width:500px;', 'wysiwyg' => true, 'required' => true, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), ));
also add this to your controller initAction() before return.
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) { $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); }
That's all done.
Great work.
ReplyDeleteYeah, but where do you add this?
ReplyDeletei have add this into custom module field in admin.
ReplyDeleteHi, I know the post is a bit old, but I have done what you said and I get a JS error: "tinyMceWysiwygSetup is not defined". Do you have any ideas? Magento 1.5.1.0
ReplyDeleteIts may be you don't correctly placed below code.
Deleteif (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
i can`t insert variable plz help me.
ReplyDelete