20fév/120
Afficher l’éditeur WYSIWYG dans un module personnalisé
Ajouté la fonction suivante dans app/code/local/Namespace/Module/Block/Adminhtml/Module/Edit/Edit.php :
protected function _prepareLayout() {
// Load Wysiwyg on demand and Prepare layout
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
return parent::_prepareLayout();
}
Ensuite, pour activer l'éditeur de WYSIWYG pour votre attribut, ajouter la propriété wysiwyg (app/code/local/Namespace/Module/Block/Module/Edit/tab/Form.php) :
$fieldset->addField('description', 'editor', array(
'name' => 'description',
'label' => Mage::helper('recipe')->__('Description'),
'title' => Mage::helper('recipe')->__('Description'),
'style' => 'width:700px; height:200px;',
'wysiwyg' => true,
'required' => true,
));