0

I'm trying to do the following to allow the CkEditor to be used with a rule-based email.

function mymodule_form_rules_ui_edit_element_alter(&$form, $form_state, $form_id) {
  $form['parameter']['message']['settings']['message']['#type'] = 'text_format';
  $form['parameter']['message']['settings']['message']['#format'] = 'full_html';
} 

I receive the following warning.

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain()

The email I receive contains Array as body. It seems like I am hitting the issue described on Add a method for easily enabling CKEditor on a specific textarea.

Is there a way to convert the output of CkEditor into a string?

2
  • 1
    Drupal 7, out of the box, does not allow you to send HTML emails. Don't forget to fix it by installing Mime Mail module.
    – AKS
    Nov 15 '12 at 1:25
  • Thanks but I have a bunch of email modules installed and working properly, and that's not my issue.
    – Webdrips
    Nov 15 '12 at 9:00
2

I had the same problem and I figured it out myself how to resolve it.

You should use a text_formatted field, not text_format, otherwise the Rules module cannot correctly render the field. You need to use a different hook_rules_action_info_alter() to change the field type, as in the following code.

function mymodule_rules_action_info_alter(&$actions) {
  $actions['mimemail']['parameter']['body']['type'] = 'text_formatted';
  $actions['mimemail_to_users_of_role']['parameter']['body']['type'] = 'text_formatted';
}

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.