You are here

function _messaging_callback_invoke in Messaging 6.3

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

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

File

./messaging.module, line 791

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