I'm developing a fieldtype add-on and within the fieldtype, I would like to include the option to let users choose Wygwam as the text element, if they have it installed.

Is there some sort of a "build" method in Wygwam I can use within my fieldtype? Similar to the way the native RTE has the following, which you can use to initialize and assign it to text areas:

ee()->rte_lib->build_js(0, '.textarea_class', NULL, TRUE);

Anyone know if Wygwam has something similar, or anyone have experience in using Wygwam within their own fieldtype?

1 Answer 1


I've done it before. Take a look at the display_field method of ft.wygwam.php. You'll see that it's fairly simple to instantiate a WYGWAM field. A few calls to the Wygwam_Helper class to load the JS/CSS. There are also some helpers for properly formatting the data. You'll need a textarea with an id, and also the ID number of a WYGWAM config. I don't want to replicate their code here, since it's proprietary, but this should send you in the right direction.

  • Cool. Thanks for pointing me in the right direction. Commented Nov 6, 2013 at 10:26
  • I was able to get this to work using the following lines: require_once(PATH_THIRD . 'wygwam/ft.wygwam.php'); $wyg = new Wygwam_ft(); $wyg->_init(array('field_name' => 'field_id_85', 'settings' => array('config' => 1, 'defer' => 'y'))); $wyg->display_field($text); Commented Aug 9, 2017 at 21:18

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.