Hi,

I'd like to theme the outgoing notify email messages but, leave the messages viewed on the site the same. is there a way to separate the themes of each?

thanks.

Comments

sepehr.sadatifar’s picture

@psychobyte I want to do the same, did you find any solution?
tnx

psychobyte’s picture

Not yet. Kinda put this on the back burner for now. I'll definitely update this issue when I get more involved in it. Maybe in a month or so.

So far, the most promising techniques that I've found are here. I just havent' tried them yet.

https://www.drupal.org/node/1740550
http://stackoverflow.com/questions/7757284/how-to-apply-template-tpl-fil...

sepehr.sadatifar’s picture

@psychobyte tnx for solutions.
I first tried to use 'theme_hook_suggestions' in 'hooK_preprocess_entity' but unfortunately this doesn't work for 'message' entities as mentioed in your first link.
this is how I managed to theme outgoing email:
defining two new themes in 'hook_theme'. one for starting html codes of mail (....) and one for closing tags (...).
using 'hook_entity _view_mode_alter' to alter 'message' entity which is about to be rendered before message notify sends the email:

function my_module_entity_view_mode_alter(&$view_mode, $context) {
  $body = $context['entity']->content['message__message_text__1']['#markup'];
  $body = theme('message__header') . $body . theme('message__footer');
  $context['entity']->content['message__message_text__1']['#markup'] = $body;
}

the final version of this function has some codes to use Emogrifier module for converting a css file to inline styles (html emails only supports inline styles).
I hope this helps other ppl with the same problem.

bluegeek9’s picture

Status: Active » Closed (outdated)