[Fixed] Magento MediabrowserUtility is not defined

If you are experiencing the "MediabrowserUtility is not defined" error when trying to add an image via the Magento WYSIWYG editor, here are steps you can try to fix it:

MediabrowserUtility is not defined

Following are steps to fix this issue:

Step 1: Add the following code into your field app/code/local/Namespace/Module/Block/Adminhtml/Item/Edit.php:

protected function _prepareLayout() {
		if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
				$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
				$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
		}
		parent::_prepareLayout();
	}

Step 2: Open app/code/local/Namespace/Module/Block/Adminhtml/Item/Edit/Tab/Form.php and add this code before your editor field:

$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/',
		)); 

Step 3: Finally, open module.xml file that is in app/design/adminhtml/default/default/layout and add the following code:

<module_adminhtml_item_edit>
    <reference name="head"> 
			<action method="addItem"><type>js</type><name>mage/adminhtml/wysiwyg/tiny_mce/setup.js</name></action>
			<action method="addItem"><type>js</type><name>tiny_mce/tiny_mce.js</name></action>
		</reference>
		<update handle="editor"/>
  </module_adminhtml_item_edit>

3 thoughts on “[Fixed] Magento MediabrowserUtility is not defined”

3 Responses to [Fixed] Magento MediabrowserUtility is not defined

Comments