You are here

function theme_elasticsearch_watchdog_message in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc \theme_elasticsearch_watchdog_message()
  2. 7.2 modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc \theme_elasticsearch_watchdog_message()

Returns HTML for a log message.

Parameters

array $variables: An associative array containing:

  • event_id: An object id.
  • event: An object with at least the message and variables properties.
  • link: (optional) Format message as link, event->wid is required.
2 theme calls to theme_elasticsearch_watchdog_message()
elasticsearch_watchdog_event in modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc
Page callback: Displays details about a specific log message.
elasticsearch_watchdog_overview in modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc
Page callback: Displays a listing of log messages.

File

modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc, line 558
Created on Jan 06, 2014

Code

function theme_elasticsearch_watchdog_message($variables) {
  $output = '';
  $event = $variables['event'];

  // Check for required properties.
  if (isset($event['message']) && isset($event['variables'])) {

    // Messages without variables or user specified text.
    if ($event['variables'] === 'N;') {
      $output = $event['message'];
    }
    else {
      $output = t($event['message'], unserialize($event['variables']));
    }
    if ($variables['link'] && isset($variables['event_id'])) {

      // Truncate message to 56 chars.
      $output = truncate_utf8(filter_xss($output, array()), 56, TRUE, TRUE);
      $output = l($output, 'admin/reports/elasticlog/elastic-message/' . $variables['event_id'], array(
        'html' => TRUE,
      ));
    }
  }
  return $output;
}