You are here

function _messaging_callback_add in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 messaging.module \_messaging_callback_add()
  2. 6 messaging.module \_messaging_callback_add()
  3. 6.2 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...) *

1 call to _messaging_callback_add()
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Exercise basic API functions

File

./messaging.module, line 890

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