You are here

function messaging_send_method in Messaging 7

Same name and namespace in other branches
  1. 6.4 messaging.module \messaging_send_method()
  2. 6.3 messaging.module \messaging_send_method()

Get send method object

Parameters

$method: Method name or Messaging_Method object

$method_info: Array of properties to build a custom send method or override existing ones

7 calls to messaging_send_method()
messaging_admin_method_settings in ./messaging.admin.inc
Default sending methods settings
messaging_admin_settings in ./messaging.admin.inc
Admin settings form
messaging_admin_test_post_form_submit in ./messaging.admin.inc
Post test message
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Exercise basic API functions
Messaging_Destination::validate_method in ./messaging.destination.inc
Validate values to create a destination

... See full list

File

./messaging.module, line 226

Code

function messaging_send_method($method, $method_info = array()) {
  $send_methods =& drupal_static(__FUNCTION__);
  if (is_object($method)) {
    return $method;
  }
  if (!isset($send_methods[$method])) {

    // This will init the method list if not done before
    if ($info = messaging_method_info($method)) {
      $class = !empty($info['class']) ? $info['class'] : 'Messaging_Send_Method';
      $send_methods[$method] = new $class($method, $method_info + $info);
    }
    else {

      // No info available from modules. This is a custom method or a disabled one
      $send_methods[$method] = new Messaging_Send_Method($method, $method_info);

      // Add to static cache so it can be found later
      $static_info =& messaging_info('send methods');
      $static_info[$method] = $method_info;
    }
  }
  return $send_methods[$method];
}