You are here

public function TMGMTJob::addMessage in Translation Management Tool 7

Add a log message for this job.

Parameters

$message: The message to store in the log. Keep $message translatable by not concatenating dynamic values into it! Variables in the message should be added by using placeholder strings alongside the variables argument to declare the value of the placeholders. See t() for documentation on how $message and $variables interact.

$variables: (Optional) An array of variables to replace in the message on display.

$type: (Optional) The type of the message. Can be one of 'status', 'error', 'warning' or 'debug'. Messages of the type 'debug' will not get printed to the screen.

1 call to TMGMTJob::addMessage()
TMGMTJob::setState in entity/tmgmt.entity.job.inc
Updates the state of the job.

File

entity/tmgmt.entity.job.inc, line 249

Class

TMGMTJob
Entity class for the tmgmt_job entity.

Code

public function addMessage($message, $variables = array(), $type = 'status') {

  // Save the job if it hasn't yet been saved.
  if (!empty($this->tjid) || $this
    ->save()) {
    $message = tmgmt_message_create($message, $variables, array(
      'tjid' => $this->tjid,
      'type' => $type,
      'uid' => $GLOBALS['user']->uid,
    ));
    if ($message
      ->save()) {
      return $message;
    }
  }
  return FALSE;
}