Browse Source

Allow modules to modify which object is being loaded.

pull/611/head
Jordan Dukart 10 years ago
parent
commit
4445858df2
  1. 4
      includes/metadata.inc
  2. 22
      islandora.api.php
  3. 2
      islandora.module

4
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.

22
islandora.api.php

@ -794,3 +794,25 @@ 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;
}

2
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');
// @todo Add Documentation.
define('ISLANDORA_OBJECT_INGESTED_HOOK', 'islandora_object_ingested');

Loading…
Cancel
Save