diff --git a/includes/metadata.inc b/includes/metadata.inc index bf59b830..9a75cd05 100644 --- a/includes/metadata.inc +++ b/includes/metadata.inc @@ -20,6 +20,8 @@ function islandora_retrieve_metadata_markup(AbstractObject $object, $print = FAL $viewer = variable_get('islandora_metadata_display', 'dublin_core'); $markup = ''; if (isset($viewers[$viewer]['metadata callback'])) { + $hooks = islandora_build_hook_list(ISLANDORA_METADATA_OBJECT_ALTER, $object->models); + drupal_alter($hooks, $object); $markup = call_user_func($viewers[$viewer]['metadata callback'], $object, $print); // The callback doesn't have any markup provided for this particular object, // default back to the dublin_core display. @@ -44,6 +46,8 @@ function islandora_retrieve_description_markup(AbstractObject $object) { $viewer = variable_get('islandora_metadata_display', 'dublin_core'); $markup = ''; if (isset($viewers[$viewer]['description callback'])) { + $hooks = islandora_build_hook_list(ISLANDORA_METADATA_OBJECT_DESCRIPTION_ALTER, $object->models); + drupal_alter($hooks, $object); $markup = call_user_func($viewers[$viewer]['description callback'], $object); // The callback doesn't have any markup provided for this particular object, // default back to the dublin_core display. diff --git a/islandora.api.php b/islandora.api.php index cea0c3ca..30b8623a 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -795,6 +795,28 @@ function hook_islandora_metadata_display_info() { ); } +/** + * Allows modifications to the object whose metadata is being rendered. + * + * @param AbstractObject $object + * An AbstractObject representing an object within Fedora. + */ +function hook_islandora_metadata_object_alter(AbstractObject &$object) { + $this_other_object = islandora_object_load('awild:indirectionappears'); + $object = $this_other_object; +} + +/** + * Allows modifications to the object whose metadata is being rendered. + * + * @param AbstractObject $object + * An AbstractObject representing an object within Fedora. + */ +function hook_islandora_metadata_object_description_alter(AbstractObject &$object) { + $this_other_object = islandora_object_load('awild:indirectionappears'); + $object = $this_other_object; +} + /** * Defines predicates to be searched for when constructing breadcrumbs. * diff --git a/islandora.module b/islandora.module index f171776e..5e0f16eb 100644 --- a/islandora.module +++ b/islandora.module @@ -49,6 +49,8 @@ define('ISLANDORA_POST_INGEST_HOOK', 'islandora_ingest_post_ingest'); define('ISLANDORA_PRE_PURGE_OBJECT_HOOK', 'islandora_pre_purge_object'); define('ISLANDORA_POST_PURGE_OBJECT_HOOK', 'islandora_post_purge_object'); define('ISLANDORA_UPDATE_RELATED_OBJECTS_PROPERTIES_HOOK', 'islandora_update_related_objects_properties'); +define('ISLANDORA_METADATA_OBJECT_ALTER', 'islandora_metadata_object'); +define('ISLANDORA_METADATA_OBJECT_DESCRIPTION_ALTER', 'islandora_metadata_object_description'); define('ISLANDORA_BREADCRUMB_FILTER_PREDICATE_HOOK', 'islandora_get_breadcrumb_query_predicates'); // @todo Add Documentation.