You are here

function notifications_build_method in Notifications 6.3

Same name and namespace in other branches
  1. 6.4 notifications.module \notifications_build_method()
  2. 7 notifications.module \notifications_build_method()

Information about building method for a send interval.

Return value

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

3 calls to notifications_build_method()
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_build_method($send_interval = NULL) {
  $build_methods =& messaging_static(__FUNCTION__);
  $intervals =& messaging_static(__FUNCTION__ . '_intervals');
  if (!isset($build_methods)) {

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

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

    // Default, that will be 'short' if interval > 0, none otherwise
    return $send_interval > 0 && isset($build_methods['short']) ? $build_methods['short'] : 'simple';
  }
}