How to add Wysiwyg editor in Magento custom module

Topics focus on Web Developments, Programming, Database, Digital Marketing Tutorials, Code Snippets, SEO, Social Media Marketing and Inspirational articles.

How to add Wysiwyg editor in Magento custom module

How to add Wysiwyg editor in Magento custom module

How to add Wysiwyg editor in Magento custom module

Considering custom module Custom_Demo

Add following function in Custom_Demo_Block_Adminhtml_Demo_Edit

1
2
3
4
5
6
protected function _prepareLayout() {
    parent::_prepareLayout();
    if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
        $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
    }
}

Then use as in grid from Custom_Demo_Block_Adminhtml_Demo_Edit_Tab_Form

1
2
3
4
5
6
7
8
9
$fieldset->addField("short_description", "editor", array(
	  "label" => Mage::helper("helpername")->__("Short Description"),
	  "class" => "required-entry",
	  "required" => true,
	  "name" => "short_description",
	  'config'    => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
	  'wysiwyg'   => true,
	)
);

Add comment


 

Pin It on Pinterest

Share This