function QueueExampleForm::processQueueItemForTable

Same name in other branches
  1. 8.x-1.x queue_example/src/Forms/QueueExampleForm.php \Drupal\queue_example\Forms\QueueExampleForm::processQueueItemForTable()
  2. 4.0.x modules/queue_example/src/Form/QueueExampleForm.php \Drupal\queue_example\Form\QueueExampleForm::processQueueItemForTable()

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

modules/queue_example/src/Form/QueueExampleForm.php, line 428

Class

QueueExampleForm
Form with examples on how to use queue.

Namespace

Drupal\queue_example\Form

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;
}