From 254ee5d60be9b3e169d4483778b350f9c23ed3c8 Mon Sep 17 00:00:00 2001 From: willtp87 Date: Tue, 8 Apr 2014 13:32:59 -0300 Subject: [PATCH 1/2] passing derivative deffinition to callback (usefull for single callback handling many derivatives) --- includes/derivatives.inc | 16 ++++++++++------ islandora.api.php | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/includes/derivatives.inc b/includes/derivatives.inc index d25789cc..2f4adc51 100644 --- a/includes/derivatives.inc +++ b/includes/derivatives.inc @@ -49,7 +49,7 @@ function islandora_do_derivatives(AbstractObject $object, array $options) { } foreach ($hook['function'] as $function) { if (function_exists($function)) { - $logging = call_user_func($function, $object, $options['force']); + $logging = call_user_func($function, $object, $options['force'], $hook); if (!empty($logging)) { $results[] = $logging; } @@ -142,11 +142,15 @@ function islandora_do_batch_derivatives(AbstractObject $object, array $options) $file = $hook['file']; } foreach ($hook['function'] as $function) { - $operations[] = array('islandora_derivative_perform_batch_operation', array( - $function, - $file, - $object->id, - $options['force']), + $operations[] = array( + 'islandora_derivative_perform_batch_operation', + array( + $function, + $file, + $object->id, + $options['force'], + $hook + ), ); } } diff --git a/islandora.api.php b/islandora.api.php index d32b7fdf..eeeeae1c 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -635,7 +635,7 @@ function hook_CMODEL_PID_islandora_overview_object_alter(AbstractObject &$object * - function: An array of function(s) to be ran when constructing * derivatives. Functions that are defined to be called for derivation * creation must have the following structure: - * module_name_derivative_creation_function($object, $force = FALSE) + * module_name_derivative_creation_function($object, $force = FALSE, $hook) * These functions must return an array in the structure of: * - success: Bool denoting whether the operation was successful. * - messages: An array structure containing zero or more array's with the From 7be2653ba646af812fdfaa7c3ef7996265c4d208 Mon Sep 17 00:00:00 2001 From: willtp87 Date: Tue, 8 Apr 2014 13:47:51 -0300 Subject: [PATCH 2/2] forgot comma --- includes/derivatives.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/derivatives.inc b/includes/derivatives.inc index 2f4adc51..635c1c54 100644 --- a/includes/derivatives.inc +++ b/includes/derivatives.inc @@ -149,7 +149,7 @@ function islandora_do_batch_derivatives(AbstractObject $object, array $options) $file, $object->id, $options['force'], - $hook + $hook, ), ); }