You are here

function notifications_digest_line in Notifications 6.4

Same name and namespace in other branches
  1. 5 notifications.cron.inc \notifications_digest_line()
  2. 6 notifications.cron.inc \notifications_digest_line()
  3. 6.2 notifications.cron.inc \notifications_digest_line()
  4. 6.3 notifications_digest/notifications_digest.module \notifications_digest_line()

Digest each line, with some caching for performance

2 calls to notifications_digest_line()
NotificationsTemplatesTests::testNotificationsTemplates in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_digest_build_short in notifications_digest/notifications_digest.module
Digest multiple events in a single message, short format.

File

notifications_digest/notifications_digest.module, line 321
Notifications digest module

Code

function notifications_digest_line($event, $method, $language) {
  static $digest = array();
  if (!isset($digest[$event->eid][$method])) {

    // The event may have an specific digest line, otherwise use template if present or even information
    if ($text = $event
      ->get_text('digest')) {
      $line = $text;
    }
    elseif ($part = $event
      ->message_part('digest', $method, $language)) {
      $line = $part;
    }
    else {

      // Get it from event information
      $line = $event
        ->get_type('line');
    }
    $digest[$event->eid][$method] = $line;
    notifications_debug('Created digest line for event', array(
      'event' => $event->eid,
      'line' => $line,
    ));
  }
  return $digest[$event->eid][$method];
}