1 queue_example.module theme_queue_items($variables)

Themes the queue display.

Again, this is not part of the demonstration of the queue API, but is here just to make the user interface more understandable.

Parameters

array $variables: Our variables.

Related topics

File

modules/examples/queue_example/queue_example.module, line 306
Hook implementations for the Queue Example module.

Code

function theme_queue_items($variables) {
  $items = $variables['items'];
  $rows = array();
  foreach ($items as &$item) {
    if ($item['expire'] > 0) {
      $item['expire'] = t("Claimed: expires %expire", array('%expire' => date('r', $item['expire'])));
    }
    else {
      $item['expire'] = t('Unclaimed');
    }
    $item['created'] = date('r', $item['created']);
    $item['content'] = check_plain(unserialize($item['data']));
    unset($item['data']);
    $rows[] = $item;
  }
  if (!empty($rows)) {
    $header = array(
      t('Item ID'),
      t('Claimed/Expiration'),
      t('Created'),
      t('Content/Data'),
    );
    $output = theme('table', array('header' => $header, 'rows' => $rows));
    return $output;
  }
  else {
    return t('There are no items in the queue.');
  }
}