Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

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/'));
$fieldset->addField('my_field_name','editor',array(
            'label' => Mage::helper('mymodule')->__('Some text'),
            'name' =>  'my_field_name',
            'config'    => $wysiwygConfig,
            'required'=>true,
            'style'=>'width:400px;height:300px;'
)); 

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

 $myobject->getData('my_field_name')

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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'));
share|improve this answer
    
Thank you, that is what I was looking for! –  JohnyFree Mar 31 at 10:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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