You are here

function notifications_digest_message_part in Notifications 6.4

Get message part text

3 calls to notifications_digest_message_part()
notifications_digest_build_long in notifications_digest/notifications_digest.module
Digest multiple events in a single message, long format.
notifications_digest_build_short in notifications_digest/notifications_digest.module
Digest multiple events in a single message, short format.
notifications_digest_group in notifications_digest/notifications_digest.module
Get text parts for digests.

File

notifications_digest/notifications_digest.module, line 301
Notifications digest module

Code

function notifications_digest_message_part($key, $method, $type, $field, $language, $module = 'notifications') {
  static $cache;
  $parts = array(
    $module,
    'digest',
    $type,
    $field,
  );
  $template = implode('-', array_filter($parts));
  if (!isset($cache[$template][$method][$key])) {
    $text = messaging_template_text_part($template, $key, $method, $language);
    if (!isset($text) && $module != 'notifications') {

      // We try module fallback with notifications
      $text = notifications_digest_message_part($key, $method, $type, $field, $language, 'notifications');
    }

    // Store it always as string or empty string
    $cache[$template][$method][$key] = $text ? $text : '';
  }
  return $cache[$template][$method][$key];
}