You are here

function notifications_digest_method in Notifications 6.2

Same name and namespace in other branches
  1. 5 notifications.module \notifications_digest_method()
  2. 6 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

4 calls to notifications_digest_method()
NotificationsLiteTests::testNotificationsLite in tests/notifications_lite.test
Test simple sending cases
NotificationsTemplatesTests::testNotificationsTemplates in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_process_compose in ./notifications.cron.inc
Message composition.
notifications_send_intervals_form in ./notifications.admin.inc
Send intervals administration

File

./notifications.module, line 1033
Notifications module

Code

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

    // 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 not set and interval > 0, none otherwise
    return !isset($intervals[$send_interval]) && $send_interval > 0 ? $digest_methods['short'] : NULL;
  }
}