You are here

function _messaging_callback_add in Messaging 6.4

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

Add a callback to a callback collection

Parameters

$callback_list: Existing callback list or method info array

$type: Callback type

$callback: Callback function name or array('function_name', arg1, arg2...) *

File

./messaging.module, line 786

Code

function _messaging_callback_add(&$callback_list, $type, $callback) {
  $name = $type . ' callback';

  // If the existing callback is a single function name, make it an array
  if (!empty($callback_list[$name]) && !is_array($callback_list[$name])) {
    $callback_list[$name] = array(
      $callback_list[$name],
    );
  }
  $callback_list[$name][] = $callback;
}