function oa_messages_preprocess_mimemail_message in Open Atrium Core 7.2
Implements hook_preprocess_mimemail_message().
File
- modules/
oa_messages/ oa_messages.module, line 657
Code
function oa_messages_preprocess_mimemail_message(&$variables) {
$message = !empty($variables['message']['params']['message_entity']) ? $variables['message']['params']['message_entity'] : array();
$vars['message'] = $message;
$variables['timestamp'] = !empty($message->timestamp) ? format_date($message->timestamp, 'long') : '';
// Sometimes WYSIWYG adds an extra \n<p> to the beginning
$body =& $variables['body'];
$pattern = "#\n<p> (.*)<\\/p>#s";
$matches = array();
if (preg_match($pattern, $body, $matches)) {
$body = $matches[1];
}
// Allow the body of the HTML to be changed for specific message types
$variables['body'] = trim(theme(array(
'oa_messages_body__' . $variables['key'],
), $variables));
// Add in our custom css.
$stylesheet = drupal_get_path('module', 'oa_messages') . '/css/oa-messages-mail.css';
$css = drupal_load_stylesheet($stylesheet, TRUE);
// End the file with a new line.
$css .= "\n";
// End copying
// Wordwrap to adhere to RFC821
$css = wordwrap($css, 700);
// Set styles for the message.
$variables['css'] .= $css;
}