You are here

function _messaging_info in Messaging 6.3

Same name and namespace in other branches
  1. 6 messaging.module \_messaging_info()
  2. 6.2 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_method_info in ./messaging.module
Returns messaging methods properties
messaging_template_info in messaging_template/messaging_template.module
Returns information about message template groups, always in default language

File

./messaging.module, line 922

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;
  }
}