You are here

public function DbLogController::formatMessage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/dblog/src/Controller/DbLogController.php \Drupal\dblog\Controller\DbLogController::formatMessage()

Formats a database log message.

Parameters

object $row: The record from the watchdog table. The object properties are: wid, uid, severity, type, timestamp, message, variables, link, name.

Return value

string|false The formatted log message or FALSE if the message or variables properties are not set.

3 calls to DbLogController::formatMessage()
DbLogController::eventDetails in core/modules/dblog/src/Controller/DbLogController.php
Displays details about a specific database log message.
DbLogController::overview in core/modules/dblog/src/Controller/DbLogController.php
Displays a listing of database log messages.
DbLogController::topLogMessages in core/modules/dblog/src/Controller/DbLogController.php
Shows the most frequent log messages of a given event type.

File

core/modules/dblog/src/Controller/DbLogController.php, line 350
Contains \Drupal\dblog\Controller\DbLogController.

Class

DbLogController
Returns responses for dblog routes.

Namespace

Drupal\dblog\Controller

Code

public function formatMessage($row) {

  // Check for required properties.
  if (isset($row->message) && isset($row->variables)) {

    // Messages without variables or user specified text.
    if ($row->variables === 'N;') {
      $message = $row->message;
    }
    else {
      $message = $this
        ->t($row->message, unserialize($row->variables));
    }
  }
  else {
    $message = FALSE;
  }
  return $message;
}