function development_environment_supressed_email_log_page in Development Environment 7
Page definition showing the log data for a single suppressed email.
Parameters
StdClass $mail_log: The log item containing the email data, used to build the page.
Return value
array A render array representing the page.
1 string reference to 'development_environment_supressed_email_log_page'
- development_environment_menu in ./
development_environment.module - Implements hook_menu().
File
- includes/
development_environment.pages.inc, line 67 - Holds menu callbacks for pages created by the Development Environment module.
Code
function development_environment_supressed_email_log_page(StdClass $mail_log) {
global $user;
$mail_info = unserialize($mail_log->email_data);
if (is_array($mail_info['body'])) {
$body = implode('<br/>', $mail_info['body']);
}
else {
$body = $mail_info['body'];
}
$page = array(
'header' => array(
'#prefix' => '<h2>',
'#suffix' => '</h2>',
'#markup' => t('The following email was not sent as this is a development environment'),
),
'email' => array(
'#type' => 'fieldset',
'#title' => t('Email data'),
'#attributes' => array(
'class' => array(
'collapsible',
),
),
'time' => array(
'#prefix' => '<p>',
'#suffix' => '</p>',
'#markup' => t('Time: %time', array(
'%time' => format_date($mail_log->timestamp, 'short', '', $user->timezone),
)),
),
'recipient' => array(
'#prefix' => '<p>',
'#suffix' => '</p>',
'#markup' => t('Recipient: %recipient', array(
'%recipient' => $mail_info['to'],
)),
),
'subject' => array(
'#prefix' => '<p>',
'#suffix' => '</p>',
'#markup' => t('Subject: %subject', array(
'%subject' => $mail_info['subject'],
)),
),
'body' => array(
'#prefix' => '<div>',
'#suffix' => '</div><br/>',
'#markup' => t('Body: %body', array(
'%body' => $body,
)),
),
'headers' => array(
'#prefix' => '<div>',
'#suffix' => '</div>',
'#markup' => t('Headers:') . development_environment_var_dump($mail_info['headers'], TRUE, TRUE),
),
),
'raw_mail_data' => array(
'#type' => 'fieldset',
'#title' => t('Raw email data'),
'#attributes' => array(
'class' => array(
'collapsible',
'collapsed',
),
),
'data' => array(
'#markup' => development_environment_var_dump($mail_info, TRUE, TRUE),
),
),
'#attached' => array(
'library' => array(
array(
'system',
'drupal.collapse',
),
),
),
);
return $page;
}