You are here

function _messaging_info in Messaging 6.2

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

Helper function to get property from an info array

Depending on method and property, returns the full array or a specific property

3 calls to _messaging_info()
messaging_message_group in ./messaging.module
Returns information about message groups
messaging_message_info in ./messaging.module
Returns parts of messages, that may be formatted for each sending method
messaging_method_info in ./messaging.module
Returns messaging methods properties

File

./messaging.module, line 1218

Code

function _messaging_info($info, $method = NULL, $property = NULL, $default = NULL) {
  if ($method && $property) {
    return isset($info[$method][$property]) ? $info[$method][$property] : $default;
  }
  elseif ($method) {
    return isset($info[$method]) ? $info[$method] : $default;
  }
  elseif ($property) {

    // Get this property as a list indexed by method
    $props = array();
    foreach ($info as $method => $values) {
      if (isset($values[$property])) {
        $props[$method] = $values[$property];
      }
    }
    return $props;
  }
  else {
    return $info;
  }
}