As a learning process, I am developing a field type that will allow me to insert data from multiple text inputs and text area fields (similar to an address field with text fields for address, state, postal code, etc.) So far so good.

I have been using the form_input and form_textarea methods from Codeigniter's form helper to generate the fields, but I was wondering if there is a way of implementing the native RTE as another option. Is there some sort of EE helper method to generate the RTE in my own field type's display method?

2 Answers 2


You can also do this with the rte_lib:

ee()->load->library(array('javascript', 'rte_lib'));

  ee()->rte_lib->build_js(0, '.WysiHat-field', NULL, TRUE)

$field_output = ee()->rte_lib->display_field('<p>Your text</p>', 'your_field_name', array(
  'field_ta_rows' => 3,
  'field_text_direction' => 'ltr',
  'field_fmt' => 'none',//xhtml or br or none
  • Yep. This is what I ended up doing. This way it also uses the users toolset setup rather than hard coding it in. Works on multiple instances too :) Jun 9, 2013 at 11:41

OK, Turns out you only need to apply the Wysihat JS on a text area to initialize it (Docs here for the EE/jQuery ported version).

What I did was first check for the installed RTE in the exp_fieldtypes table, then injected the JS into the CP if it was present:

$this->EE->cp->add_to_foot('<script type="text/javascript">$(function(){ $("textarea").wysihat({"buttons" : ["bold","italic","underline"]}); });</script>');

Will probably do something cleaner later, but at least it works now :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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