function notifications_feed_token_values in Notifications 6
Same name and namespace in other branches
- 5 notifications_feed/notifications_feed.module \notifications_feed_token_values()
Implementation of hook_token_values()
File
- notifications_feed/
notifications_feed.module, line 241 - Subscriptions to FeedAPI feeds
Code
function notifications_feed_token_values($type, $object = NULL, $options = array()) {
switch ($type) {
case 'feed':
if ($feed = $object) {
$values['feed-name'] = check_plain($feed->title);
$values['feed-teaser'] = $feed->teaser ? check_markup($feed->teaser, $feed->format, FALSE) : '';
// We may need to use a different link here
$values['feed-url'] = url('node/' . $feed->nid, array(
'absolute' => TRUE,
));
// Item lists
$updated = !empty($feed->items_updated) ? array_map('check_plain', $feed->items_updated) : array();
$new = !empty($feed->items_new) ? array_map('check_plain', $feed->items_new) : array();
$refreshed = array();
foreach ($new as $item) {
$refreshed[] = t('New: !title', array(
'!title' => $item,
));
}
foreach ($updated as $item) {
$refreshed[] = t('Updated: !title', array(
'!title' => $item,
));
}
$values['feed-items-updated'] = theme('notifications_feed_items', $updated);
$values['feed-items-new'] = theme('notifications_feed_items', $new);
$values['feed-items-refresh'] = theme('notifications_feed_items', $refreshed);
return $values;
}
break;
}
}