From 2a0b6ea058aaf1d3ad683356325ff167e54b7b79 Mon Sep 17 00:00:00 2001 From: mitchmac Date: Fri, 1 Mar 2013 11:25:50 -0400 Subject: [PATCH] Add hook_islandora_object_event to allow event listening to SOAP calls --- api/fedora_item.inc | 1 + fedora_repository.api.php | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 0443548d..6566dd08 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -1475,6 +1475,7 @@ RDF; watchdog('fedora_repository', 'Error Trying to call SOAP function "%func". Exception: @e in @f(@l)\n@t', array('%func' => $function, '@e' => $e->getMessage(), '@f' => $e->getFile(), '@l' => $e->getLine(), '@t' => $e->getTraceAsString()), NULL, WATCHDOG_ERROR); return NULL; } + module_invoke_all('islandora_object_event', $function, $parameters, $result); return $result; } diff --git a/fedora_repository.api.php b/fedora_repository.api.php index 3fb23dc4..9b27f5a6 100644 --- a/fedora_repository.api.php +++ b/fedora_repository.api.php @@ -146,3 +146,23 @@ function hook_fedora_repository_can_ingest($collection_pid) { function hook_fedora_repository_check_perm($op, $pid = NULL, $as_user = NULL) { return NULL; } + +/** + * Implements hook_islandora_object_event(). + * + * This hook allows modules to listen to most object events; anything that goes through + * Fedora_Item::soap_call will be passed to hook implementers. + * + * Implementing code should be constructed to avoid infinite loops if cascading functions. + * + * @param $function + * The SOAP function that has been called. + * @param $parameters + * The parameters sent to the SOAP call. + * @param $result + * The result of the SOAP call. + */ +function hook_islandora_object_event($function, $parameters, $result) { + // Respond to a SOAP event. +} +