Browse Source

passing derivative deffinition to callback (usefull for single callback handling many derivatives)

pull/477/head
willtp87 11 years ago
parent
commit
254ee5d60b
  1. 16
      includes/derivatives.inc
  2. 2
      islandora.api.php

16
includes/derivatives.inc

@ -49,7 +49,7 @@ function islandora_do_derivatives(AbstractObject $object, array $options) {
} }
foreach ($hook['function'] as $function) { foreach ($hook['function'] as $function) {
if (function_exists($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)) { if (!empty($logging)) {
$results[] = $logging; $results[] = $logging;
} }
@ -142,11 +142,15 @@ function islandora_do_batch_derivatives(AbstractObject $object, array $options)
$file = $hook['file']; $file = $hook['file'];
} }
foreach ($hook['function'] as $function) { foreach ($hook['function'] as $function) {
$operations[] = array('islandora_derivative_perform_batch_operation', array( $operations[] = array(
$function, 'islandora_derivative_perform_batch_operation',
$file, array(
$object->id, $function,
$options['force']), $file,
$object->id,
$options['force'],
$hook
),
); );
} }
} }

2
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 * - function: An array of function(s) to be ran when constructing
* derivatives. Functions that are defined to be called for derivation * derivatives. Functions that are defined to be called for derivation
* creation must have the following structure: * 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: * These functions must return an array in the structure of:
* - success: Bool denoting whether the operation was successful. * - success: Bool denoting whether the operation was successful.
* - messages: An array structure containing zero or more array's with the * - messages: An array structure containing zero or more array's with the

Loading…
Cancel
Save