From 1c7666842b1b517c0eb41c717e794961e45b7939 Mon Sep 17 00:00:00 2001 From: Jason MacWilliams Date: Fri, 11 May 2012 16:26:51 -0300 Subject: [PATCH] invoke custom hooks to retrieve metadata display instead of hard-coding it --- plugins/FedoraObjectDetailedContent.inc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/plugins/FedoraObjectDetailedContent.inc b/plugins/FedoraObjectDetailedContent.inc index 30e222a6..a6656571 100644 --- a/plugins/FedoraObjectDetailedContent.inc +++ b/plugins/FedoraObjectDetailedContent.inc @@ -48,8 +48,29 @@ class FedoraObjectDetailedContent { $tabset['fedora_object_details']['tabset'] = array( '#type' => 'tabset', ); - - $dc_html = $objectHelper->getFormattedDC($this->item); + + // ***** Jason: begin object details display profiles + module_load_include('inc', 'fedora_repository', 'ObjectDetails'); + $object_details_profile = variable_get('islandora_object_details_display_table', 'xslt_dc'); + $profiles = module_invoke_all("islandora_object_details_display"); + $profile = $profiles[$object_details_profile]; + if (!isset($profile)) { + // default behaviour + drupal_set_message(t("There was an error reading the default object details display profile"), "error"); + $dc_html = $objectHelper->getFormattedDC($this->item); + } + else { + // invoke the requested display profile + require_once(drupal_get_path('module', $profile['module']) ."/". $profile['file']); + $details_function = $profile['function']; + if (function_exists($details_function)) { + $dc_html = $details_function($this->item); + } + else { + // problem + } + } + // ***** Jason: end object details display profiles $i = 0; if (fedora_repository_access(OBJECTHELPER :: $VIEW_DETAILED_CONTENT_LIST, $this->pid, $user)) {