Browse Source

Add content model dependant call of hook_islandora_object_view_alter().

pull/306/head
Adam Vessey 12 years ago
parent
commit
7c9b20237b
  1. 13
      islandora.api.php
  2. 5
      islandora.module

13
islandora.api.php

@ -50,6 +50,19 @@ function hook_CMODEL_PID_islandora_view_object($object) {
function hook_islandora_view_object_alter(&$object, &$rendered) { 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. * Generate an object's management display.
* *

5
islandora.module

@ -675,7 +675,8 @@ function islandora_view_object(FedoraObject $object) {
$page_number = (empty($_GET['page'])) ? '1' : $_GET['page']; $page_number = (empty($_GET['page'])) ? '1' : $_GET['page'];
$page_size = (empty($_GET['pagesize'])) ? '10' : $_GET['pagesize']; $page_size = (empty($_GET['pagesize'])) ? '10' : $_GET['pagesize'];
$output = array(); $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 // @todo Remove page number and size from this hook, implementers of the
// hook should use drupal page handling directly. // hook should use drupal page handling directly.
$temp = module_invoke_all($hook, $object, $page_number, $page_size); $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); $output = islandora_default_islandora_view_object($object);
} }
arsort($output); arsort($output);
drupal_alter(ISLANDORA_VIEW_HOOK, $object, $output); drupal_alter($hooks, $object, $output);
return implode('', $output); return implode('', $output);
} }

Loading…
Cancel
Save