0

I have created a custom module in the adminpanel where i need to show an HTML editor. The field is showing properly with the HTML editor but the issue is that its showing all the buttons and options in the editor (Please see the image below).

enter image description here

But i only want to show options like Bold,Italic,Underscore. How can i do this. Here is the code im using to show the editor.

app/code/local/MyModule/Producteditrequest/Block/Adminhtml/Producteditrequest/Edit/Tab/Form.php

    protected function _prepareForm(){

    $form = new Varien_Data_Form(array('id' => 'edit_form',
                                          'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
                                          'method' => 'post',
                        ));
    $fieldset = $form->addFieldset('producteditrequest_form', array('legend'=>Mage::helper('producteditrequest')->__('Edit Request  ')));
    .
    .
    .
    .
    .
    .
    .
    $fieldset->addField('shortdesc', 'editor', array(
                'name'      => 'shortdesc',
                'label'     => Mage::helper('producteditrequest')->__('Short Description'),
                'title'     => Mage::helper('producteditrequest')->__('Short Description'),
                'style'     => 'width:98%; height:200px;',
                'wysiwyg'   => true,
                'config'    => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
                'required'  => true,
                'value' => $pdtEditDetails['short_desc']
            ));
$this->setForm($form);
.
.
.
}

[Please note that i have only included the relevant parts of my code since its a very big function]

I have tried following methods to configure the editor which found from /app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php

$config = array()
$config['add_variables']         = false;
$config['add_widgets']           = false;
$config['add_directives']        = true;
$config['use_container']         = true;
$config['container_class']       = 'hor-scroll';

$fieldset->addField('shortdesc', 'editor', array(
            'name'      => 'shortdesc',
            'label'     => Mage::helper('producteditrequest')->__('Short Description'),
            'title'     => Mage::helper('producteditrequest')->__('Short Description'),
            'style'     => 'width:98%; height:200px;',
            'wysiwyg'   => true,
            'config'    => Mage::getSingleton('cms/wysiwyg_config')->getConfig($config),
            'required'  => true,
            'value' => $pdtEditDetails['short_desc']
        ));

But still its showing all the options as in the above image.

I have also tried putting following javascript code in the phtml file.

    <script type="text/javascript">
window.onload=function()
{
   tinyMCE.init({
    mode : "exact",
    elements: "shortdesc",
    theme : "advanced",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|",
    doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'

  });
};
</script>

But there is no change.

How can i make the editor configurable in the adminpanel.

0

I think Below Links Can be Used for you :

1) https://www.pixafy.com/blog/2013/01/overcoming-magentos-built-in-wysiwyg-editor/

2) https://www.pixafy.com/blog/2012/06/content-management-wysiwygs-and-css3/

  • @nikhil : Tried My Answer? – H_Parekh Jan 4 '17 at 10:05

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.