public function LocalTask::setStatus

Updates the status of the task.

Parameters

int $status: The new status of the task. Has to be one of the task status constants.

string $message: (Optional) The log message to be saved along with the status change.

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

string $type: (optional) The message type.

Return value

int The updated status of the task if it could be set.

Overrides LocalTaskInterface::setStatus

See also

Job::addMessage()

File

translators/tmgmt_local/src/Entity/LocalTask.php, line 259

Class

LocalTask
Entity class for the local task entity.

Namespace

Drupal\tmgmt_local\Entity

Code

public function setStatus($status, $message = NULL, $variables = array(), $type = 'debug') {

  // Return TRUE if the status could be set. Return FALSE otherwise.
  if (array_key_exists($status, $this
    ->getStatuses())) {
    $this
      ->incrementLoopCount($status, $this->tuid->target_id);
    $this->status = $status;
    $this
      ->save();
  }
  return $this->status;
}