From 7c9b20237bb8a2487a79040f1baed9a19ca37c10 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Sat, 6 Apr 2013 16:40:08 -0300 Subject: [PATCH] Add content model dependant call of hook_islandora_object_view_alter(). --- islandora.api.php | 13 +++++++++++++ islandora.module | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/islandora.api.php b/islandora.api.php index 5e976194..a4fe1552 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -50,6 +50,19 @@ function hook_CMODEL_PID_islandora_view_object($object) { function hook_islandora_view_object_alter(&$object, &$rendered) { } +/** + * Alter display output if the object has the given model. + * + * @see hook_islandora_view_object_alter() + * @param FedoraObject $object + * A Tuque FedoraObject being operated on. + * @param array $rendered + * An arr of rendered views. + */ +function hook_CMODEL_PID_islandora_view_object_alter(&$object, &$rendered) { + +} + /** * Generate an object's management display. * diff --git a/islandora.module b/islandora.module index 981189bc..eafa271a 100644 --- a/islandora.module +++ b/islandora.module @@ -675,7 +675,8 @@ function islandora_view_object(FedoraObject $object) { $page_number = (empty($_GET['page'])) ? '1' : $_GET['page']; $page_size = (empty($_GET['pagesize'])) ? '10' : $_GET['pagesize']; $output = array(); - foreach (islandora_build_hook_list(ISLANDORA_VIEW_HOOK, $object->models) as $hook) { + $hooks = islandora_build_hook_list(ISLANDORA_VIEW_HOOK, $object->models); + foreach ($hooks as $hook) { // @todo Remove page number and size from this hook, implementers of the // hook should use drupal page handling directly. $temp = module_invoke_all($hook, $object, $page_number, $page_size); @@ -688,7 +689,7 @@ function islandora_view_object(FedoraObject $object) { $output = islandora_default_islandora_view_object($object); } arsort($output); - drupal_alter(ISLANDORA_VIEW_HOOK, $object, $output); + drupal_alter($hooks, $object, $output); return implode('', $output); }