function Notifications_Subscription::format_items in Notifications 7
Same name and namespace in other branches
- 6.4 includes/notifications_subscription.class.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 ./
notifications.subscription.inc - Format all fields
File
- ./
notifications.subscription.inc, line 1484 - Drupal Notifications Framework - Default class file
Class
- Notifications_Subscription
- Common base for subscription type and subscription instance
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', array(
'items' => $items,
));
case $format & self::FORMAT_TABLE:
return theme('table', array(
'rows' => $items,
));
default:
// Items not formatted, return as array
return $items;
}
}