You are here

function _messaging_callback_invoke in Messaging 6

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

Invoke callback with variable arguments

We don't check whether the function exists so it will crash if it's missing

Parameters

$callback: Function name or array(function, arg1, arg2..)

$arg1, $arg2...: Variable number of arguments

4 calls to _messaging_callback_invoke()
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Exercise basic API functions
messaging_message_invoke in ./messaging.module
Invoke callbacks
messaging_message_send_out in ./messaging.module
Send for real, finally invoking method's callback function
messaging_user_destination in ./messaging.module
Get destination from user account

File

./messaging.module, line 904

Code

function _messaging_callback_invoke() {
  $args = func_get_args();
  $callback = array_shift($args);
  if (is_array($callback)) {

    // It is an array: function, arg1, arg2...
    $function = array_shift($callback);
    $params = $callback;
  }
  else {

    // It is just a function name
    $function = $callback;
    $params = array();
  }

  // Merge parameters and go for it
  $params = array_merge($params, $args);
  return call_user_func_array($function, $params);
}