You are here

function _messaging_callback_add in Messaging 6

Same name and namespace in other branches
  1. 6.4 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

$type: Callback type

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

2 calls to _messaging_callback_add()
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Exercise basic API functions
messaging_notify_messaging_methods_alter in messaging_notify/messaging_notify.module
Implementation of hook_messaging_methods_alter()

File

./messaging.module, line 982

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