Hi there,
Im writting a module to edit site content.
Is there an easy was to include the RTE that modx uses for the normal page editing?
I want all the same features etc, but just in my module?
Thanks
J
-
☆ A M B ☆
- 24,524 Posts
ConseilsWeb updated my mailing list port to use the RTE:
// Get access to template variable function (to output the RTE)
include_once($modx->config['base_path'].'manager/includes/tmplvars.inc.php');
$event_output = $modx->invokeEvent("OnRichTextEditorInit", array('editor'=>$modx->config['which_editor'], 'elements'=>array('tvmailMessage')));
if(is_array($event_output)) {
$editor_html = implode("",$event_output);
}
// Get HTML for the textarea, last parameters are default_value, elements, value
$rte_html = renderFormElement('richtext', 'mailMessage', '', '', '');
echo $rte_html;
echo $editor_html;
You should be able to use it as-is, other than changing the ’mailMessage’ parameter to whatever the name of your textarea field.