wysiwyg editor Magento Custom Module

wysiwyg editor Magento Custom Module

Step 1 – Go to app/code/local/Webkul/Faq/Block here webkul is namespace and faq is module name , under your _prepareLayout() function add this code

 public function _prepareLayout()
 {
 if (Mage::getSingleton(‘cms/wysiwyg_config’)->isEnabled() && ($block = $this->getLayout()->getBlock(‘head’))) {
 $block->setCanLoadTinyMce(true);
 }
 return parent::_prepareLayout();
 }

Then go to app/code/local/Webkul/Faq/Block/Adminhtml/Faq/Edit/Tab
and add following code in your _prepareForm() function below your setform() . $this->setForm($form);

 $wysiwygConfig = Mage::getSingleton(‘cms/wysiwyg_config’)->getConfig(array(‘add_variables’ => false, ‘add_widgets’ => false,’files_browser_window_url’=>$this->getBaseUrl().’admin/cms_wysiwyg_images/index/’));
 then define this as $fieldset
 $fieldset->addField(‘body’, ‘editor’, array(
 ‘name’ => ‘body’,
 ‘label’ => Mage::helper(‘faq’)->__(‘Content’),
 ‘title’ => Mage::helper(‘faq’)->__(‘Content’),
 ‘style’ => ‘width:700px; height:500px;’,
 ‘state’ => ‘html’,
 ‘config’ => $wysiwygConfig,
 ‘wysiwyg’ => true,
 ‘required’ => true,
 ));

This post is original on webkul

You may also like...

Creating a Shopify App using Laravel How to Create Custom WordPress Plugin? How to Build a Telegram Bot using PHP How to Convert Magento 2 into PWA?