You are here

public function MaillogController::details in Maillog / Mail Developer 8

Get the Maillog entry.

Parameters

int $maillog_id: The Maillog ID.

Return value

array The output fields

1 string reference to 'MaillogController::details'
maillog.routing.yml in ./maillog.routing.yml
maillog.routing.yml

File

src/Controller/MaillogController.php, line 49

Class

MaillogController
Primary controler behind the Maillog module.

Namespace

Drupal\maillog\Controller

Code

public function details($maillog_id) {
  $maillog_entry = $this
    ->getMaillogEntry(intval($maillog_id));
  if (!$maillog_entry) {
    throw new NotFoundHttpException();
  }
  $output = [];
  $output['#title'] = $maillog_entry['subject'];
  $output['header_from'] = [
    '#title' => t('From'),
    '#type' => 'item',
    '#markup' => Html::escape($maillog_entry['header_from']),
  ];
  $output['header_to'] = [
    '#title' => t('To'),
    '#type' => 'item',
    '#markup' => Html::escape($maillog_entry['header_to']),
  ];
  $output['header_reply_to'] = [
    '#title' => t('Reply to'),
    '#type' => 'item',
    '#markup' => Html::escape($maillog_entry['header_reply_to']),
  ];
  $output['header_all'] = [
    '#title' => t('All'),
    '#type' => 'item',
    '#markup' => '<pre>',
  ];
  foreach ($maillog_entry['header_all'] as $header_all_name => $header_all_value) {
    $output['header_all']['#markup'] .= Html::escape($header_all_name) . ': ' . Html::escape($header_all_value) . '<br/>';
  }
  $output['header_all']['#markup'] .= '</pre>';
  $output['body'] = [
    '#title' => t('Body'),
    '#type' => 'item',
    '#markup' => '<pre>' . Html::escape($maillog_entry['body']) . '</pre>',
  ];
  return $output;
}