I have a custom module. Inside _prepareForm I have also field editor.

$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => true,'files_browser_window_url'=>$this->getUrl().'admin/cms_wysiwyg_images/index/'));
            'label' => Mage::helper('mymodule')->__('Some text'),
            'name' =>  'my_field_name',
            'config'    => $wysiwygConfig,

I can insert widget inside editor and when I press Save, it is still proper recognized. But when I call that field value inside template


it will show

{{widget type="cms/widget_block" template="cms/widget/static_block/default.phtml" block_id="1"}}

instead of actual widget content.

How does Magento parse data if widget is inside, how can I show this widget once it was inserted inside editor?


Getting my_field_name will return you raw content from the database. You have to pass it through CMS processor:

echo Mage::helper('cms')->getBlockTemplateProcessor()->filter($myobject->getData('my_field_name'));

In your Block file you can override the _toHtml method. It is the magento filter static block and cms pages content :

protected function _toHtml()
    $html = parent::_toHtml();
    return Mage::helper('cms')->getBlockTemplateProcessor()->filter($html);

In this way it will process all your content. See in these files :


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.