You are here

function notifications_digest_method in Notifications 6

Same name and namespace in other branches
  1. 5 notifications.module \notifications_digest_method()
  2. 6.2 notifications.module \notifications_digest_method()

Information about digesting method for a send interval.

Return value

array() Ditest information for that interval, or all the information if no interval

3 calls to notifications_digest_method()
NotificationsTemplatesTests::testNotificationsTemplates in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_process_send in ./notifications.cron.inc
Message delivery.
notifications_send_intervals_form in ./notifications.admin.inc
Send intervals administration

File

./notifications.module, line 984
Notifications module

Code

function notifications_digest_method($send_interval = NULL) {
  static $digest_methods, $intervals;
  if (!isset($digest_methods)) {

    // Method information
    foreach (notifications_module_information('digest methods') as $method) {
      $digest_methods[$method['type']] = $method;
    }

    // Mapping interval -> method
    $intervals = variable_get('notifications_digest_methods', array());
  }
  if (is_null($send_interval)) {
    return $digest_methods;
  }
  elseif (!empty($intervals[$send_interval]) && isset($digest_methods[$intervals[$send_interval]])) {
    return $digest_methods[$intervals[$send_interval]];
  }
  else {

    // Default, that will be 'short' if interval > 0, none otherwise
    return $send_interval > 0 ? $digest_methods['short'] : NULL;
  }
}