You are here

function template_preprocess_emaillog in Logging and alerts 8

Same name and namespace in other branches
  1. 6.2 emaillog/emaillog.module \template_preprocess_emaillog()
  2. 7.2 emaillog/emaillog.module \template_preprocess_emaillog()
  3. 2.0.x emaillog/emaillog.module \template_preprocess_emaillog()

Process variables for emaillog.tpl.php.

File

emaillog/emaillog.module, line 131
Drupal Module: Email Logging and Alerts.

Code

function template_preprocess_emaillog(&$variables) {
  global $base_url;
  $user = User::load($variables['log']['variables']['uid']);
  $variables['base_url'] = $base_url;
  $severity_list = RfcLogLevel::getLevels();
  $message_body = new FormattableMarkup($variables['log']['message'], $variables['log']['variables']);
  $variables['log']['severity_desc'] = Unicode::ucfirst($severity_list[$variables['log']['severity']]
    ->render());
  $variables['log']['datetime'] = date('Y-m-d H:i:s', $variables['log']['variables']['timestamp']);
  $variables['log']['uid'] = $user
    ->id();
  $variables['log']['name'] = $user
    ->getDisplayName();
  $variables['log']['link'] = strip_tags($variables['log']['variables']['link']);
  $variables['log']['message'] = strip_tags($message_body);
  $severity = _emaillog_system_string($severity_list[$variables['log']['severity']]
    ->render());
  $variables['theme_hook_suggestions'][] = 'emaillog__' . $severity;
  $variables['theme_hook_suggestions'][] = 'emaillog__' . _emaillog_system_string($variables['log']['variables']['channel']);
  $variables['theme_hook_suggestions'][] = 'emaillog__' . $severity . '__' . _emaillog_system_string($variables['log']['variables']['channel']);
}