public function TransitionSet::toJSON in Lightning Workflow 8.2
Same name and namespace in other branches
- 8.3 modules/lightning_scheduler/src/TransitionSet.php \Drupal\lightning_scheduler\TransitionSet::toJson()
Represents the transition set as a JSON string.
Return value
string The transition set as a JSON array of objects, each of which has the following properties:
- 'state': The targeted workflow state ID.
- 'when': The UTC date and time of the transition in ISO 8601 format.
File
- modules/
lightning_scheduler/ src/ TransitionSet.php, line 74
Class
Namespace
Drupal\lightning_schedulerCode
public function toJSON() {
$data = [];
foreach ($this->dateList as $delta => $item) {
$data[$delta] = [
'state' => $this->stateList[$delta]->value,
'when' => $item->date
->format('c', [
'timezone' => 'UTC',
]),
];
}
return Json::encode($data);
}