You are here

private function QueueExampleForm::processQueueItemForTable in Examples for Developers 8

Helper method to format a queue item for display in a summary table.

Parameters

array $item: Queue item array with keys for item_id, expire, created, and data.

Return value

array An array with the queue properties in the right order for display in a summary table.

File

queue_example/src/Forms/QueueExampleForm.php, line 428

Class

QueueExampleForm
Form with examples on how to use queue.

Namespace

Drupal\queue_example\Forms

Code

private function processQueueItemForTable(array $item) {
  if ($item['expire'] > 0) {
    $item['expire'] = $this
      ->t('Claimed: expires %expire', [
      '%expire' => date('r', $item['expire']),
    ]);
  }
  else {
    $item['expire'] = $this
      ->t('Unclaimed');
  }
  $item['created'] = date('r', $item['created']);
  $item['content'] = Html::escape(unserialize($item['data']));
  unset($item['data']);
  return $item;
}