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/5] 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 183d01dc5de3308663bb64a30e4df8ff0ef66a39 Mon Sep 17 00:00:00 2001 From: "Bryan J. Brown" Date: Fri, 14 Apr 2017 11:42:17 -0400 Subject: [PATCH 2/5] ISLANDORA-1928: Updates erroneous hook names in islandora.api.php (#669) --- islandora.api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/islandora.api.php b/islandora.api.php index 1580b68a..3f00bf57 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -353,7 +353,7 @@ function hook_islandora_datastream_modified(AbstractObject $object, AbstractData * * @see hook_islandora_datastream_modified() */ -function hook_cmodel_pid_islandora_datastream_modified(AbstractObject $object, AbstractDatastream $datastream, array $params) { +function hook_cmodel_pid_dsid_islandora_datastream_modified(AbstractObject $object, AbstractDatastream $datastream, array $params) { } @@ -377,7 +377,7 @@ function hook_islandora_datastream_purged(AbstractObject $object, $dsid) { * * @see hook_islandora_datastream_purged() */ -function hook_cmodel_pid_islandora_datastream_purged(AbstractObject $object, $dsid) { +function hook_cmodel_pid_dsid_islandora_datastream_purged(AbstractObject $object, $dsid) { } From 6dfaf007f7f3e8fbdb0ab1affa74c22089feee80 Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Thu, 20 Apr 2017 13:35:48 -0400 Subject: [PATCH 3/5] 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, From 023de6e550d8dc955a8b3bdc76da17b6e8dd9999 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Thu, 27 Apr 2017 17:09:34 -0300 Subject: [PATCH 4/5] Don't use a constant not defined in earlier PHPs. (#674) --- islandora.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index e060ce12..ff919ef7 100644 --- a/islandora.module +++ b/islandora.module @@ -2094,8 +2094,8 @@ function islandora_conditionally_clear_cache() { // batches, since they are not in response to GUI actions. '_batch_process' => 'islandora_schedule_cache_clear_for_batch', ); - - foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS & ~DEBUG_BACKTRACE_PROVIDE_OBJECT) as $frame) { + $options = (version_compare(PHP_VERSION, '5.3.6', '>=') ? DEBUG_BACKTRACE_IGNORE_ARGS & ~DEBUG_BACKTRACE_PROVIDE_OBJECT : FALSE); + foreach (debug_backtrace($options) as $frame) { $function_name = strtolower($frame['function']); if (isset($functions[$function_name])) { $clear = TRUE; From b014b6285a2919fc73a15bc908b2de1d3c47616d Mon Sep 17 00:00:00 2001 From: Neil Mader Date: Wed, 3 May 2017 15:26:52 -0300 Subject: [PATCH 5/5] 7.x islandora 1071 (#672) * Changed hook_preprocess_HOOK() to template_preprocess_HOOK() * Changed hook_preprocess_HOOK() to template_preprocess_HOOK() * Changed hook_preprocess_HOOK() to template_preprocess_HOOK() * Modified comments to say template_preprocess_Hook() * Changed _Hook to upper case in comments in 3 spots. * Changed hook_preprocess() to template_preprocess_HOOK() * Changed hook_preprocess() to template_preprocess_HOOK() * Changed hook_preprocess() to template_preprocess_HOOK() --- theme/theme.inc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/theme/theme.inc b/theme/theme.inc index 4405c288..81c4a33f 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -6,9 +6,9 @@ */ /** - * Implements hook_preprocess_theme(). + * Implements template_preprocess_HOOK(). */ -function islandora_preprocess_islandora_default_edit(array &$variables) { +function template_preprocess_islandora_default_edit(array &$variables) { global $base_url; $islandora_object = $variables['islandora_object']; $datastreams = array(); @@ -116,9 +116,9 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { } /** - * Implements hook_preprocess_theme(). + * Implements template_preprocess_HOOK(). */ -function islandora_preprocess_islandora_default(&$variables) { +function template_preprocess_islandora_default(&$variables) { drupal_add_js('misc/form.js'); drupal_add_js('misc/collapse.js'); $islandora_object = $variables['islandora_object']; @@ -170,9 +170,9 @@ function islandora_preprocess_islandora_default(&$variables) { } /** - * Implements hook_preprocess_theme(). + * Implements template_preprocess_HOOK(). */ -function islandora_preprocess_islandora_object_print(array &$variables) { +function template_preprocess_islandora_object_print(array &$variables) { // Apply the print CSS in non print context. $only_print_media = function($o) { return $o['media'] == 'print'; @@ -623,9 +623,9 @@ function theme_islandora_datastream_regenerate_link(array $vars) { } /** - * Implements hook_preprocess(). + * Implements template_preprocess_HOOK(). */ -function islandora_preprocess_islandora_dublin_core_display(array &$variables) { +function template_preprocess_islandora_dublin_core_display(array &$variables) { $islandora_object = $variables['islandora_object']; if (islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $islandora_object['DC'])) { try { @@ -640,9 +640,9 @@ function islandora_preprocess_islandora_dublin_core_display(array &$variables) { } /** - * Implements hook_preprocess(). + * Implements template_preprocess_HOOK(). */ -function islandora_preprocess_islandora_dublin_core_description(array &$variables) { +function template_preprocess_islandora_dublin_core_description(array &$variables) { $islandora_object = $variables['islandora_object']; if (islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $islandora_object['DC'])) { try { @@ -660,9 +660,9 @@ function islandora_preprocess_islandora_dublin_core_description(array &$variable } /** - * Implements hook_preprocess(). + * Implements template_preprocess_HOOK(). */ -function islandora_preprocess_islandora_object_overview(array &$variables) { +function template_preprocess_islandora_object_overview(array &$variables) { $object = $variables['islandora_object']; $cmodels = $object->models; $links = array();