|
|
|
@ -70,12 +70,14 @@ function theme_islandora_basic_image_view_object($variables) {
|
|
|
|
|
return drupal_render($render_array); |
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Theme registry function |
|
|
|
|
* We supply a pattern so we can overide templates at the theme level if needed. |
|
|
|
|
* we can append a pid to a template and the new template file will be called (the pids |
|
|
|
|
* colon should be replaced with a dash) |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
function islandora_basic_image_theme() { |
|
|
|
|
function islandora_basic_image_theme($existing, $type, $theme, $path) { |
|
|
|
|
return array( |
|
|
|
|
'islandora_basic_image_objects' => array( |
|
|
|
|
'template' => 'islandora-basic-image-view-objects', |
|
|
|
@ -83,6 +85,9 @@ function islandora_basic_image_theme() {
|
|
|
|
|
), |
|
|
|
|
'islandora_basic_image' => array( |
|
|
|
|
'template' => 'islandora-basic-image', |
|
|
|
|
'pattern' => 'islandora_basic_image__', //we can add pids to the end of this pattern in our preprocess function |
|
|
|
|
// and templates will be able to have have a pid appended to the template name to overide a template on a per object basis |
|
|
|
|
//an example template would be named islandora-basic-image--islandora-27.tpl.phps |
|
|
|
|
'variables' => array('islandora_object' => NULL), |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
@ -92,13 +97,12 @@ function islandora_basic_image_theme() {
|
|
|
|
|
* tells the main module what types of objects we support. This is used to determine whether or not |
|
|
|
|
* this module should attempt to respond. |
|
|
|
|
* @return array |
|
|
|
|
* array of content model pids that this module supports |
|
|
|
|
*/ |
|
|
|
|
function islandora_basic_image_islandora_get_types() { |
|
|
|
|
return array('info:fedora/islandora:imgageCModel', 'info:fedora/islandora:sp_basic_image'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* this modules implentation of view_object will handle objects of type islandora:basicImageCModel and info:fedora/islandora:sp_basic_image |
|
|
|
|
* as registered in its return types |
|
|
|
@ -123,23 +127,27 @@ function islandora_basic_image_islandora_view_object($object, $user, $page_numbe
|
|
|
|
|
return array('Basic Image Output' => $output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @global type $base_url |
|
|
|
|
* @param array $variables |
|
|
|
|
* an array of variables that will be passed to the theme function |
|
|
|
|
*/ |
|
|
|
|
function islandora_preprocess_islandora_basic_image(&$variables) { |
|
|
|
|
$islandora_object = $variables['islandora_object']; |
|
|
|
|
module_load_include('inc', 'islandora', 'utils/islandora_dublin_core'); |
|
|
|
|
try { |
|
|
|
|
$dc = $islandora_object['DC']->content; |
|
|
|
|
//$dc_xml = simplexml_load_string($dc); |
|
|
|
|
$dc_object = Dublin_Core::import_from_xml_string($dc); |
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); |
|
|
|
|
} |
|
|
|
|
$variables['islandora_dublin_core'] = $dc_object; |
|
|
|
|
$variables['islandora_object_label'] = $islandora_object->label; |
|
|
|
|
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id); |
|
|
|
|
global $base_url; |
|
|
|
|
$variables['islandora_image_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view'; |
|
|
|
|
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view'; |
|
|
|
|
$variables['islandora_medium_size_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/MEDIUM/view'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?> |
|
|
|
|