From b1f1da9293f753c33de360753ea6be7f719c50eb Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Thu, 13 Apr 2017 11:42:16 -0400 Subject: [PATCH 1/2] Allow a null abstract object in derivative alter hook --- islandora.api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.api.php b/islandora.api.php index 1580b68a..6b010a6a 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -746,7 +746,7 @@ function hook_cmodel_pid_islandora_derivative() { /** * Allows for the altering of defined derivative functions. */ -function hook_islandora_derivative_alter(&$derivatives, AbstractObject $object, $ds_modified_params = array()) { +function hook_islandora_derivative_alter(&$derivatives, AbstractObject $object = NULL, $ds_modified_params = array()) { foreach ($derivatives as $key => $derivative) { if ($derivative['destination_dsid'] == 'TN') { unset($derivatives[$key]); From 6dfaf007f7f3e8fbdb0ab1affa74c22089feee80 Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Thu, 20 Apr 2017 13:35:48 -0400 Subject: [PATCH 2/2] Rosie is right Adding default to $object argument in derivative_alter hook implementation to be congruent with the API definition --- tests/islandora_derivatives_test.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/islandora_derivatives_test.module b/tests/islandora_derivatives_test.module index 4a46eb66..91ef8fef 100644 --- a/tests/islandora_derivatives_test.module +++ b/tests/islandora_derivatives_test.module @@ -48,7 +48,7 @@ function islandora_derivatives_test_some_cmodel_islandora_derivative() { /** * Implements hook_islandora_CMODEL_PID_derivative_alter(). */ -function islandora_derivatives_test_some_cmodel_islandora_derivative_alter(&$derivatives, AbstractObject $object, $ds_modified_params) { +function islandora_derivatives_test_some_cmodel_islandora_derivative_alter(&$derivatives, AbstractObject $object = NULL, $ds_modified_params = array()) { // Use a mask to determine if only the label has been modified. $diff = array_diff_key($ds_modified_params, array( 'label' => NULL,