You are here

function messaging_method_info in Messaging 5

Same name and namespace in other branches
  1. 6.4 messaging.module \messaging_method_info()
  2. 6 messaging.module \messaging_method_info()
  3. 6.2 messaging.module \messaging_method_info()
  4. 6.3 messaging.module \messaging_method_info()
  5. 7 messaging.module \messaging_method_info()

Returns messaging methods properties

Parameters

$method: Optional, Method to get properties for, none or NULL for all methods

$property: Optional, Property to get, none or NULL for all properties

$default: Optional default value to return when there's not that property for the method

14 calls to messaging_method_info()
messaging_admin_settings in ./messaging.module
Admin settings form
messaging_admin_template_overview in ./messaging.module
Overview page for message templates
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Play with creating, retrieving, deleting a pair messages
messaging_debug_send_user in messaging_debug/messaging_debug.module
Just show message title to the user.
messaging_message_send in ./messaging.module
Send message to array of destinations. The message is rendered just once.

... See full list

File

./messaging.module, line 747

Code

function messaging_method_info($method = NULL, $property = NULL, $default = NULL, $refresh = FALSE) {
  static $info, $properties;
  if (!$info || $refresh) {
    $info = module_invoke_all('messaging', 'send methods');

    // Merge settings for each enabled method
    foreach (array_keys($info) as $name) {
      $info[$name] = array_merge($info[$name], variable_get('messaging_method_' . $name, array()));
    }

    /*
    if ($settings = variable_get('messaging_methods', array())) {
      $info = array_merge_recursive($info, $settings);
    }
    */
  }
  if ($method && $property) {
    return isset($info[$method][$property]) ? $info[$method][$property] : $default;
  }
  elseif ($method) {
    return isset($info[$method]) ? $info[$method] : array();
  }
  elseif ($property) {
    if (!isset($properties[$property])) {
      $properties[$property] = array();
      foreach ($info as $method => $values) {
        if (isset($values[$property])) {
          $properties[$property][$method] = $values[$property];
        }
      }
    }
    return $properties[$property];
  }
  else {
    return $info;
  }
}