You are here

function messaging_message_callbacks in Messaging 6.3

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

Invoke ordered list of callbacks on message

For each callback name this function will search existing callbacks in $info ('[name] callback') and if not existing will try the default callback 'messaging_message_[name]'

Parameters

$callback_keys: Array of callbacks to invoke, ordered list

$message: Message object

$info: Messaging method info which may contain callbacks

See also

_messaging_callback() for callback structure

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

File

./messaging.module, line 822

Code

function messaging_message_callbacks($callback_keys, $message, $info) {
  while (!empty($message->process) && ($key = array_shift($callback_keys))) {
    if ($callback = _messaging_callback_get($info, $key)) {
      $message = messaging_message_invoke($callback, $message, $info);
    }
    elseif (function_exists('messaging_message_' . $key)) {
      $message = call_user_func('messaging_message_' . $key, $message, $info);
    }
  }
  return $message;
}