Magento Custom Module - WYSIWYG Image Viewer Problem

I have a custom module with content field (WYSIWYG editor)

When I select the insert image button, the following popup window appears. For some reason, the browse button on the image URL side has disappeared. Can someone point me in the right direction to return the image? (which unit / controller, etc.)

What is required when adding a full-featured WYSIWYG editor to the magento custom module?

No browse icon at side of image url

This is my form field element in Form.php (block)

$fieldset->addField('post_content', 'editor', array( 'name' => 'post_content', 'label' => Mage::helper('faqs')->__('Answer'), 'title' => Mage::helper('faqs')->__('Answer'), 'style' => 'width:700px; height:500px;', 'wysiwyg' => true, )); 

Thanks.

Johnny

+4
source share
2 answers

I was able to sort this by adding some configuration options to the field,

Add the following code above addField () of your WYSIWYG,

 $configSettings = Mage::getSingleton('cms/wysiwyg_config')->getConfig( array( 'add_widgets' => false, 'add_variables' => false, 'add_images' => false, 'files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/')); 

After you have added the code, you need to add another parameter to addField, called 'config', which calls the $ configSettings variable.

 $fieldset->addField('post_content', 'editor', array( 'name' => 'post_content', 'label' => Mage::helper('faqs')->__('Answer'), 'title' => Mage::helper('faqs')->__('Answer'), 'style' => 'width:700px; height:500px;', 'wysiwyg' => true, 'config' => $configSettings )); 
+3
source

I had to find the hard way, but the solution is quite simple:

Please check the rights of your role , your Admin is in unser System => Permissions => Roles

There you can find in the " Role Resources " tab the " Media Gallery " checkbox. Check this box!

Then clear the cache, log out and again, and it should work.

Hooray!

+5
source

Source: https://habr.com/ru/post/1432791/


All Articles