You are here

function Notifications_Subscription::format_items in Notifications 6.4

Same name and namespace in other branches
  1. 7 notifications.subscription.inc \Notifications_Subscription::format_items()

Format items

Parameters

$items: Array of arrays with 'name' and 'value' elements

1 call to Notifications_Subscription::format_items()
Notifications_Subscription::format_fields in includes/notifications_subscription.class.inc
Format all fields

File

includes/notifications_subscription.class.inc, line 865
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription
Message destination class

Code

function format_items($items, $format = self::FORMAT_INLINE) {

  // If no items the output will be always an empty string
  if (!$items) {
    return '';
  }

  // Some formats need each item to be a string first
  if ($format & self::FORMAT_INLINE) {
    foreach ($items as $key => $value) {
      if (is_array($value)) {
        $items[$key] = implode(': ', $value);
      }
    }
  }
  switch (TRUE) {
    case $format & self::FORMAT_INLINE:
      return implode(',', $items);
    case $format & self::FORMAT_LIST:
      return theme('item_list', $items);
    case $format & self::FORMAT_TABLE:
      return theme('table', array(), $items);
    default:

      // Items not formatted, return as array
      return $items;
  }
}