You are here

public function SchedulingState::getHaltedMessage in Webform Scheduled Tasks 8.2

Get the message associated with a halted task, if one exists.

Parameters

\Drupal\webform_scheduled_tasks\Entity\WebformScheduledTaskInterface $scheduledTask: The task.

Return value

string The message provided when halting the task.

Throws

\Exception Thrown when a task has not been halted.

Overrides SchedulingStateInterface::getHaltedMessage

File

src/SchedulingState.php, line 83

Class

SchedulingState
Get information about the state of task scheduling.

Namespace

Drupal\webform_scheduled_tasks

Code

public function getHaltedMessage(WebformScheduledTaskInterface $scheduledTask) {
  if (!$this
    ->isHalted($scheduledTask)) {
    throw new \Exception('Tried to get the halted task message from a task that is not halted.');
  }
  $halted_tasks = $this->state
    ->get(static::HALTED_STATE_KEY);
  return $halted_tasks[$scheduledTask
    ->id()];
}