From 2763f2b267f80d42a1c0d8e8bf1ac66c0c5369d8 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Thu, 28 Mar 2013 12:44:35 -0300 Subject: [PATCH 1/2] Use build_hook_list so we get correct hook_names when altering. --- includes/tuque_wrapper.inc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 8bd3c3e6..9904af60 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -35,10 +35,7 @@ $islandora_module_path = drupal_get_path('module', 'islandora'); * Allow modules to alter an object before a mutable event occurs. */ function islandora_alter_object(AbstractFedoraObject $object, array &$context) { - $types = array('islandora_object'); - foreach ($object->models as $model) { - $types[] = "{$model}_islandora_object"; - } + $types = islandora_build_hook_list('islandora_object', $object->models); drupal_alter($types, $object, $context); } @@ -46,11 +43,11 @@ function islandora_alter_object(AbstractFedoraObject $object, array &$context) { * Allow modules to alter a datastream before a mutable event occurs. */ function islandora_alter_datastream(AbstractFedoraObject $object, AbstractDatastream $datastream, array &$context) { - $types = array('islandora_datastream'); + $types = array(); foreach ($object->models as $model) { - $types[] = "{$model}_{$datastream->id}_islandora_datastream"; + $types[] = "{$model}_{$datastream->id}"; } - drupal_alter($types, $object, $datastream, $context); + drupal_alter(islandora_build_hook_list('islandora_datastream', $types), $object, $datastream, $context); } /** From af933e66ff97e3316b7f5cbaacdbdc24f564c1b6 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Thu, 28 Mar 2013 12:52:55 -0300 Subject: [PATCH 2/2] Add module_loads just incase and more consistency. --- includes/tuque_wrapper.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 9904af60..8e4e8a0f 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -35,14 +35,15 @@ $islandora_module_path = drupal_get_path('module', 'islandora'); * Allow modules to alter an object before a mutable event occurs. */ function islandora_alter_object(AbstractFedoraObject $object, array &$context) { - $types = islandora_build_hook_list('islandora_object', $object->models); - drupal_alter($types, $object, $context); + module_load_include('inc', 'islandora', 'includes/utilities'); + drupal_alter(islandora_build_hook_list('islandora_object', $object->models) ,$object, $context); } /** * Allow modules to alter a datastream before a mutable event occurs. */ function islandora_alter_datastream(AbstractFedoraObject $object, AbstractDatastream $datastream, array &$context) { + module_load_include('inc', 'islandora', 'includes/utilities'); $types = array(); foreach ($object->models as $model) { $types[] = "{$model}_{$datastream->id}";