2

I need to include a text editor in a custom module developed. Can anyone help how to include WysiHat or Rich text editor in a form in the module addon developed?

1

This is how I do it in ProForm and other add-ons...

Basically, you first put the needed files into the themes/third_party directory under a new directory name that matches the name of your addon's main third_party folder.

For instance, if your module is at this location:

system/expressionengine/third_party/module_name/mcp.module_name.php

You would place your assets here:

themes/third_party/module_name/

At that point you just need to include a reference to the JS/CSS files, which is pretty easy to do, just put these lines into your module's constructor:

$this->EE->cp->add_to_head('<link rel="stylesheet" href="'
    .$this->EE->config->item('theme_folder_url')
    .'third_party/module_name/editor/styles/stylesheet.css" type="text/css" media="screen" />');

$this->EE->cp->add_to_head('<script type="text/javascript" src="'
    .$this->EE->config->item('theme_folder_url')
    .'third_party/module_name/javascript/editor/javascript/prolib.js"></script>');

You can then either use an inline <script> tag in your view file to trigger the binding on the editor according to their documentation, or you can create your own external JS file and include it the same way as above in the constructor.

| improve this answer | |

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.