public function Job::addMessage

Add a log message for this job.

Parameters

string $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.

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

string $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.

Overrides JobInterface::addMessage

1 call to Job::addMessage()
Job::setState in src/Entity/Job.php
Updates the state of the job.

File

src/Entity/Job.php, line 376

Class

Job
Entity class for the tmgmt_job entity.

Namespace

Drupal\tmgmt\Entity

Code

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

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