You are here

public function TMGMTJobItem::addMessage in Translation Management Tool 7

Add a log message for this job item.

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.

3 calls to TMGMTJobItem::addMessage()
TMGMTJobItem::addTranslatedDataRecursive in entity/tmgmt.entity.job_item.inc
Recursively writes translated data to the data array of a job item.
TMGMTJobItem::dataItemRevert in entity/tmgmt.entity.job_item.inc
Reverts data item translation to the latest existing revision.
TMGMTJobItem::setState in entity/tmgmt.entity.job_item.inc
Updates the state of the job item.

File

entity/tmgmt.entity.job_item.inc, line 192

Class

TMGMTJobItem
Entity class for the tmgmt_job entity.

Code

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

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