I want to enable the WYSIWYG editor so I can create HTML mail from webform email templates. (Yes, I know some people don't like HTML in emails.) I have created a module, and I'm using this code:
function mymodulename_form_alter(&$element, &$form_state, $context) {
if (isset($element['template']['template'])) {
$element['template']['template']['#wysiwyg'] = true;
$element['template']['template']['#type'] = 'text_format';
}
}
This is great, and the WYSIWYG is enabled. Unfortunately it changes the values from a string to an array, and I can't figure out how to convert them back again. I was hoping this would help, but hook_field_attach_presave()
doesn't seem to fire for that form. In fact, I can't find any hooks that fire for that form.
Any suggestions?