Browse Source

Merge branch '7.x' of github.com:Islandora/islandora into 7.x

pull/120/merge
rwincewicz 12 years ago
parent
commit
42b60953ca
  1. 119
      includes/datastream.inc
  2. 2
      islandora-object-edit.tpl.php
  3. 165
      islandora.module
  4. 36
      islandora_basic_image/css/islandora_basic_image.theme.css
  5. 7
      islandora_basic_image/islandora-basic-image.tpl.php
  6. 21
      islandora_basic_image/islandora_basic_image.module

119
includes/datastream.inc

@ -4,6 +4,7 @@
* @file datastream.inc * @file datastream.inc
*/ */
define('DS_COMP_STREAM', 'DS-COMPOSITE-MODEL');
/** /**
* *
* @global object $user * @global object $user
@ -12,9 +13,6 @@
* @return stream * @return stream
* prints datastream to browser * prints datastream to browser
*/ */
define('DS_COMP_STREAM', 'DS-COMPOSITE-MODEL');
function islandora_datastream_as_attachment($object_id, $dsid) { function islandora_datastream_as_attachment($object_id, $dsid) {
module_load_include('inc', 'islandora', 'RestConnection'); module_load_include('inc', 'islandora', 'RestConnection');
global $user; global $user;
@ -36,7 +34,6 @@ function islandora_datastream_as_attachment($object_id, $dsid) {
exit(); exit();
} }
/** /**
* *
* @param array $arr * @param array $arr
@ -44,31 +41,29 @@ function islandora_datastream_as_attachment($object_id, $dsid) {
* @param string $ds_comp_stream * @param string $ds_comp_stream
* the dscomposite stream as xml * the dscomposite stream as xml
*/ */
function islandora_update_available_dsids_array(&$arr, $ds_comp_stream){ function islandora_get_defined_dsids_array(&$arr, $ds_comp_stream) {
$sxml = new SimpleXMLElement($ds_comp_stream); $sxml = new SimpleXMLElement($ds_comp_stream);
foreach($sxml->dsTypeModel as $ds){ foreach ($sxml->dsTypeModel as $ds) {
//$arr[$ds['ID']] //$arr[$ds['ID']]
$mimes = array(); $mimes = array();
foreach($ds->form as $form){ foreach ($ds->form as $form) {
$mimetype = (string)$form['MIME']; $mimetype = (string) $form['MIME'];
$mimes[] = $mimetype; $mimes[] = $mimetype;
} }
$dsid = (string)$ds['ID']; $dsid = (string) $ds['ID'];
if($dsid != 'AUDIT'){ if ($dsid != 'AUDIT') {
$arr[(string)$ds['ID']] = $mimes; $arr[(string) $ds['ID']] = $mimes;
} }
} }
} }
/** /**
* this function may not be being used *
* @param type $pid * @global type $user
* @param type $form_state * @param string $object_id
* @return string * @return string|array
*/ */
function islandora_add_datastream_form($object_id, &$form_state) { function islandora_get_unused_dsids($object_id) {
//dump_vars($form_state);
// Populate the list of datastream IDs.
module_load_include('inc', 'islandora', 'RestConnection'); module_load_include('inc', 'islandora', 'RestConnection');
global $user; global $user;
try { try {
@ -76,76 +71,62 @@ function islandora_add_datastream_form($object_id, &$form_state) {
$fedora_object = new FedoraObject($object_id, $restConnection->repository); $fedora_object = new FedoraObject($object_id, $restConnection->repository);
} catch (Exception $e) { } catch (Exception $e) {
drupal_set_message(t('Error getting Islandora object %s ', array('%s' => $object_id)), 'error'); drupal_set_message(t('Error getting Islandora object %s ', array('%s' => $object_id)), 'error');
return ""; return;
} }
if (!isset($fedora_object)) { if (!isset($fedora_object)) {
drupal_set_message(t('Could not create add datastream form for %s'), array('%s' => $object_id)); drupal_set_message(t('Could not create add datastream form for %s'), array('%s' => $object_id));
return; return;
} }
$models = $fedora_object->models; $models = $fedora_object->models;
$available_dsids = array(); $defined_dsids = array();
if (isset($models)) { if (isset($models)) {
foreach ($models as $model) { foreach ($models as $model) {
try { try {
$model_object = new FedoraObject($model, $restConnection->repository); $model_object = new FedoraObject($model, $restConnection->repository);
if (isset($model_object[DS_COMP_STREAM])) {
$dscomposite_stream = $model_object[DS_COMP_STREAM]->content; $dscomposite_stream = $model_object[DS_COMP_STREAM]->content;
islandora_update_available_dsids_array($available_dsids, $dscomposite_stream); islandora_get_defined_dsids_array($defined_dsids, $dscomposite_stream);
}
} catch (Exception $e) { } catch (Exception $e) {
//do nothing as other objects may have a dscompsite stream //do nothing as other objects may have a dscompsite stream
} }
//$model_ds_comp =
} }
} }
foreach ($defined_dsids as $key => $value) {
/*if (!empty($content_models)) { if (isset($fedora_object[$key])) {
foreach ($content_models as $content_model) { unset($defined_dsids[$key]); //ds exists in the object so don't show in the dropdown
$newElements = $content_model->listDatastreams();
if (!empty($newElements)) {
$available_dsids = array_merge($available_dsids, $newElements);
} }
} }
} return $defined_dsids;
}
$item = new Fedora_Item($pid);
$used_datastreams = $item->get_datastreams_list_as_SimpleXML();
$used_datastream_ids = array();
foreach ($used_datastreams->datastreamDef as $used_datastream) {
array_push($used_datastream_ids, $used_datastream->ID);
}
$unused_dsids = array();
if ($form_state['submitted'] && $form_state['clicked_button']['#value'] != 'OK') { /**
$form['add_datastream_label'] = array( * buids the default add datastream form
'#value' => t('<br /><h3>The datastream has been uploaded.</h3>'), * @param string $object_id
'#weight' => -10, * @param array $form_state
); * @return array
$form['#redirect'] = "fedora/repository/$pid/"; * a form ready to be rendered with a call to Drupal render
$form['submit'] = array( */
'#type' => 'submit', function islandora_get_add_datastream_form($object_id, &$form_state) {
'#value' => t('OK') $unused_dsids = islandora_get_unused_dsids($object_id); //$defined_dsids;
$form = array();
$form['add_fieldset'] = array(
'#type' => 'fieldset',
'#title' => 'Add a datastream',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
); );
return $form; $form['add_fieldset']['add_datastream_label'] = array(
}
if (!empty($available_dsids)) {
$unused_dsids = array_diff($available_dsids, $used_datastream_ids);
if (empty($unused_dsids)) {
return;
}
}
$form['add_datastream_label'] = array(
'#value' => t('<br /><h3>Add Datastream:</h3>'), '#value' => t('<br /><h3>Add Datastream:</h3>'),
'#weight' => -10, '#weight' => -10,
); );
$form['pid'] = array( $form['pid'] = array(
'#type' => 'hidden', '#type' => 'hidden',
'#value' => "$pid" '#value' => "$object_id"
); );
$form['stream_label'] = array( $form['add_fieldset']['stream_label'] = array(
'#title' => 'Datastream Label', '#title' => 'Datastream Label',
'#required' => 'TRUE', '#required' => 'TRUE',
'#description' => t('A Human readable label'), '#description' => t('A Human readable label'),
@ -153,35 +134,35 @@ function islandora_add_datastream_form($object_id, &$form_state) {
); );
$form['#attributes']['enctype'] = 'multipart/form-data'; $form['#attributes']['enctype'] = 'multipart/form-data';
$form['add-stream-file-location'] = array( $form['add_fieldset']['add-stream-file-location'] = array(
'#type' => 'file', '#type' => 'file',
'#title' => t('Upload Document'), '#title' => t('Upload Document'),
'#size' => 48, '#size' => 48,
// '#required'=>'TRUE', // '#required'=>'TRUE',
'#description' => t('The file to upload.') '#description' => t('The file to upload.')
); );
$form['#redirect'] = "fedora/repository/$pid/"; $form['#redirect'] = "islandora/object/$object_id/";
$form['submit'] = array( $form['add_fieldset']['submit'] = array(
'#type' => 'submit', '#type' => 'submit',
'#value' => t('Add Datastream') '#value' => t('Add Datastream')
); );
if (!empty($unused_dsids)) { if (!empty($unused_dsids)) {
$dsidsForForm = array(); $dsidsForForm = array();
foreach ($unused_dsids as $dsid) { foreach ($unused_dsids as $key => $value) {
$dsidsForForm[$dsid] = $dsid; $dsidsForForm[$key] = $key;
} }
$form['stream_id'] = array( $form['add_fieldset']['stream_id'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Datastream ID'), '#title' => t('Datastream ID'),
'#default_value' => variable_get('feed_item_length', 'teaser'), '#default_value' => variable_get('feed_item_length', 'teaser'),
'#weight' => '-1', '#weight' => '-1',
'#description' => t('Datastream IDs defined by the content model.'), '#description' => t('Datastream IDs defined by the content model.'),
); );
$form['stream_id']['#options'] = array_combine($unused_dsids, $unused_dsids); $form['add_fieldset']['stream_id']['#options'] = $dsidsForForm;
} }
else { else {
$form['stream_id'] = array( $form['add_fieldset']['stream_id'] = array(
'#title' => 'Datastream ID', '#title' => 'Datastream ID',
'#required' => 'TRUE', '#required' => 'TRUE',
'#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores.'), '#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores.'),
@ -189,5 +170,5 @@ function islandora_add_datastream_form($object_id, &$form_state) {
'#weight' => -1, '#weight' => -1,
); );
} }
return $form;*/ return $form;
} }

2
islandora-object-edit.tpl.php

@ -52,7 +52,9 @@ foreach ($islandora_datastreams as $dsid => $ds) {
print (' ' . l('download', $ds['download_url'])); print (' ' . l('download', $ds['download_url']));
print (' ' . l('delete', $ds['delete_url'])); print (' ' . l('delete', $ds['delete_url']));
print ('<br />'); print ('<br />');
} }
print (drupal_render($variables['add_datastream_form']));
print (l(t('Edit Metadata'),$variables['islandora_editmetadata_url'])); print (l(t('Edit Metadata'),$variables['islandora_editmetadata_url']));
?> ?>

165
islandora.module

@ -66,7 +66,7 @@ function islandora_menu() {
'access arguments' => array(FEDORA_ADD_DS), 'access arguments' => array(FEDORA_ADD_DS),
'file' => 'admin/islandora.solutionpacks.inc', 'file' => 'admin/islandora.solutionpacks.inc',
'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM,
);*/ ); */
$items['islandoracm.xsd'] = array( $items['islandoracm.xsd'] = array(
'title' => 'Islandora Content Model XML Schema Definition', 'title' => 'Islandora Content Model XML Schema Definition',
@ -108,15 +108,16 @@ function islandora_menu() {
'access arguments' => array(FEDORA_VIEW), 'access arguments' => array(FEDORA_VIEW),
); );
/*
$items['islandora/object/%/add'] = array( $items['islandora/object/%/add'] = array(
'title' => 'Add to an object', 'title' => 'Add to an object',
'file' => 'includes/add-menu.inc', //'file' => 'includes/add-menu.inc',
'page callback' => 'islandora_add_callback', 'page callback' => 'islandora_add_datastream',
'page arguments' => array(2), 'page arguments' => array(2),
'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FEDORA_ADD_DS) 'access arguments' => array(FEDORA_ADD_DS)
); );
*/
$items['islandora/object/%/view'] = array( $items['islandora/object/%/view'] = array(
'title' => 'View', 'title' => 'View',
@ -216,12 +217,9 @@ function islandora_menu() {
return $items; return $items;
} }
function islandora_admin_paths_alter(&$paths) { function islandora_admin_paths_alter(&$paths) {
$paths['*/manage*'] = TRUE; $paths['*/manage*'] = TRUE;
} }
/** /**
@ -346,8 +344,8 @@ function islandora_edit_object($object_id) {
return $output; return $output;
} }
function islandora_edit_properties($object_id){ function islandora_edit_properties($object_id) {
return 'edit properties '.$object_id; return 'edit properties ' . $object_id;
} }
/** /**
@ -433,7 +431,7 @@ function islandora_purge_datastream($object_id, $datastream_id) {
function islandora_view_default_object() { function islandora_view_default_object() {
$pid = variable_get('islandora_repository_pid', 'islandora:root'); $pid = variable_get('islandora_repository_pid', 'islandora:root');
return islandora_view_object($pid); drupal_goto("islandora/object/$pid");
} }
/** /**
@ -444,11 +442,11 @@ function islandora_view_default_object() {
* *
* @return string * @return string
*/ */
function islandora_view_object($object_id) { function islandora_view_object($object_id = NULL) {
//return $object_id; //return $object_id;
if (!isset($object_id)) { if (!isset($object_id)) {
drupal_set_message(t('Cannot view object, object id not set')); $object_id = variable_get('islandora_repository_pid', 'islandora:root');
return; //return;
} }
$page_number = (empty($_GET['page'])) ? '1' : $_GET['page']; $page_number = (empty($_GET['page'])) ? '1' : $_GET['page'];
@ -487,7 +485,7 @@ function islandora_islandora_view_object($object) {
$supported_models = islandora_get_types(); $supported_models = islandora_get_types();
$output = ""; $output = "";
foreach ($object->models as $model) { foreach ($object->models as $model) {
if (isset($supported_models[$model][ISLANDORA_VIEW_HOOK]) && (boolean)$supported_models[$model][ISLANDORA_VIEW_HOOK] === TRUE) {//another module is handling the view if (isset($supported_models[$model][ISLANDORA_VIEW_HOOK]) && (boolean) $supported_models[$model][ISLANDORA_VIEW_HOOK] === TRUE) {//another module is handling the view
return; return;
} }
} }
@ -550,7 +548,7 @@ function islandora_permission() {
} }
/** /**
* * renders the add datastream from.
* @param string $object_id * @param string $object_id
* @return type * @return type
*/ */
@ -559,14 +557,14 @@ function islandora_add_datastream($object_id) {
drupal_set_message(t('Cannot add datastream to object, object id not set')); drupal_set_message(t('Cannot add datastream to object, object id not set'));
return; return;
} }
//send message to synapse $object = islandora_get_object($object_id);
$object = new IslandoraObject($object_id); if (isset($object)) {
$form = drupal_get_form('islandora_add_datastream_form', $object);
if (!isset($object)) { drupal_set_title($object->label);
drupal_set_message(t('Could not remove object, object not found')); return drupal_render($form);
return;
} }
module_invoke_all('islandora_add_datastream', $object); //allow submodules to handle add datastream based on object type return "";
// hook form alter might be enough here may not need a module invoke all
} }
function islandora_preprocess_islandora_default(&$variables) { function islandora_preprocess_islandora_default(&$variables) {
@ -588,14 +586,131 @@ function islandora_preprocess_islandora_default(&$variables) {
} }
} }
function islandora_get_object($object_id) {
module_load_include('inc', 'islandora', 'RestConnection');
global $user;
try {
$restConnection = new RestConnection($user);
$fedora_object = new FedoraObject($object_id, $restConnection->repository);
} catch (Exception $e) {
drupal_set_message(t('Error getting Islandora object %s', array('%s' => $object_id)), 'error');
return NULL;
}
return $fedora_object;
}
/**
* Builds the default add a datastream form.
* @param array $form
* @param array $form_state
* @param Object $islandora_object
* @return type
*/
function islandora_add_datastream_form($form, &$form_state, $islandora_object) {
module_load_include('inc', 'islandora', 'includes/datastream');
$form = islandora_get_add_datastream_form($islandora_object->id, $form_state);
return $form;
}
/**
* Default implmentation currently only does M (managed datastreams)
* other modules can hook form alter to add other functionality
* @global string $base_url
* @global object $user
* Drupal user
* @param array $form
* @param array $form_state
* @return type
*/
function islandora_add_datastream_form_submit($form, &$form_state) {
global $base_url;
if (!empty($form_state['submit']) && $form_state['submit'] == 'OK') {
$form_state['rebuild'] = TRUE;
return;
}
$file = $form_state['values']['add-stream-file-location'];
$file = drupal_realpath($file);
$object_id = $form_state['values']['pid'];
$dsid = $form_state['values']['stream_id'];
$ds_label = $form_state['values']['stream_label']; // Add the file extention to the end of the label.;
//$dformat = $mimetype->getType($file);
$controlGroup = "M";
//if ($dformat == 'text/xml') {
// $controlGroup = 'X';
//}
global $user;
try {
$restConnection = new RestConnection($user);
$fedora_object = new FedoraObject($object_id, $restConnection->repository);
$ds = $fedora_object->constructDatastream($dsid, $controlGroup);
$ds->label = $ds_label;
$ds->setContentFromFile($file);
$fedora_object->ingestDatastream($ds);
$d_file = file_load($form_state['values']['fid']);
file_delete($d_file);
} catch (exception $e) {
drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
return;
}
$form_state['rebuild'] = TRUE;
}
/**
* validates this datastream id against its allowed mimetypes in the dscomposite
* of its content models.
* @param array $form
* @param array $form_state
* @return boolean
*/
function islandora_add_datastream_form_validate($form, &$form_state) {
module_load_include('inc', 'islandora', 'includes/MimeClass');
$mimetype = new MimeClass();
if ($form_state['clicked_button']['#value'] == 'OK') {
$form_state['rebuild'] = TRUE;
return;
}
$dsid = $form_state['values']['stream_id'];
$dsLabel = $form_state['values']['stream_label'];
if (strlen($dsid) > 64) {
form_set_error('', t('Data stream ID cannot be more than 64 characters.'));
return FALSE;
}
if (!(preg_match("/^[a-zA-Z]/", $dsid))) {
form_set_error('', t("Data stream ID (@dsid) has to start with a letter.", array('@dsid' => check_plain($dsid))));
return FALSE;
}
if (strlen($dsLabel) > 64) {
form_set_error('', t('Data stream Label cannot be more than 64 characters.'));
return FALSE;
}
if (strpos($dsLabel, '/')) {
form_set_error('', t('Data stream Label cannot contain a "/".'));
return FALSE;
}
$mimetype = new MimeClass();
$unused_dsids = islandora_get_unused_dsids($form_state['values']['pid']);
$types_allowed = $unused_dsids[$dsid];
$arr = array();
foreach ($types_allowed as $type) {
$arr[] = $mimetype->getExtension($type);
}
$file = file_save_upload('add-stream-file-location', array('file_validate_extensions' => $arr));
if ($file) {
$form_state['values']['add-stream-file-location'] = $file->uri;
$form_state['values']['fid'] = $file->fid; //so we can load it to delete later
}
else {
form_set_error('add-stream-file-location', t('There was no file uploaded'));
}
}
function islandora_preprocess_islandora_default_edit(&$variables) { function islandora_preprocess_islandora_default_edit(&$variables) {
$islandora_object = $variables['islandora_object']; $islandora_object = $variables['islandora_object'];
//module_load_include('inc', 'islandora', 'includes/datastream');
//$test = '';
//$dsids = islandora_add_datastream_form($islandora_object->id, $test);
global $base_url; global $base_url;
$datastreams = array(); $datastreams = array();
$variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id; $variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id;
$variables['add_datastream_form'] = drupal_get_form('islandora_add_datastream_form', $islandora_object);
foreach ($islandora_object as $ds) { foreach ($islandora_object as $ds) {
$datastreams['download_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/download'; $datastreams['download_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/download';
$datastreams['view_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/view'; $datastreams['view_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/view';

36
islandora_basic_image/css/islandora_basic_image.theme.css

@ -18,8 +18,8 @@
} }
.islandora-basic-image-metadata { .islandora-basic-image-metadata {
clear: both; display: block;
padding-top: 1.5em; clear: both
} }
dl.islandora-basic-image-fields { dl.islandora-basic-image-fields {
@ -33,15 +33,25 @@ dl.islandora-basic-image-fields {
/* /*
* The width + left/right padding of DTs/DDs equals 88% when compensating for an image * The width + left/right padding of DTs/DDs equals 88% when compensating for an image
*/ */
.islandora-basic-image-metadata * {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.islandora-basic-image-metadata dt { .islandora-basic-image-metadata dt {
margin-right:-1px; margin-right:-1px;
width:12.5%; width:15.625%;
font-weight: bold; font-weight: normal;
text-align: right; text-align: right;
font-weight: bold;
padding-right: 0;
} }
.islandora-basic-image-metadata dd { .islandora-basic-image-metadata dd {
width:77%; width:84.375%;
padding-left: 40px;
} }
/* /*
@ -55,15 +65,15 @@ dl.islandora-basic-image-fields {
letter-spacing:normal; letter-spacing:normal;
word-spacing:normal; word-spacing:normal;
vertical-align:top; vertical-align:top;
padding:5px 0 3px 3%; padding-top: 6px;
padding-bottom: 4px;
margin:0; margin:0;
border-top:1px solid #ddd; border-top:1px solid #e5e5e5;
-ms-word-break: break-all; }
word-break: break-all;
word-break: break-word; /* webkit */ .islandora-basic-image-metadata dt.first,
-webkit-hyphens: auto; .islandora-basic-image-metadata dd.first {
-moz-hyphens: auto; border-top:0;
hyphens: auto;
} }
.islandora-basic-image-sidebar, .islandora-basic-image-sidebar,

7
islandora_basic_image/islandora-basic-image.tpl.php

@ -32,8 +32,10 @@
<h3><?php print $dc_array['dc:description']['label']; ?></h3> <h3><?php print $dc_array['dc:description']['label']; ?></h3>
<p><?php print $dc_array['dc:description']['value']; ?></p> <p><?php print $dc_array['dc:description']['value']; ?></p>
</div> </div>
<div class="islandora-basic-image-metadata">
<h4>Details</h4> <fieldset class="collapsible collapsed islandora-basic-image-metadata">
<legend><span class="fieldset-legend">Extended Details</span></legend>
<div class="fieldset-wrapper">
<dl class="islandora-basic-image-fields"> <dl class="islandora-basic-image-fields">
<?php $row_field = 0; ?> <?php $row_field = 0; ?>
<?php foreach($dc_array as $key => $value): ?> <?php foreach($dc_array as $key => $value): ?>
@ -47,4 +49,5 @@
<?php endforeach; ?> <?php endforeach; ?>
</dl> </dl>
</div> </div>
</fieldset>
</div> </div>

21
islandora_basic_image/islandora_basic_image.module

@ -200,6 +200,8 @@ function islandora_basic_image_islandora_view_object($object, $user, $page_numbe
* an array of variables that will be passed to the theme function * an array of variables that will be passed to the theme function
*/ */
function islandora_basic_image_preprocess_islandora_basic_image(&$variables) { function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
drupal_add_js('misc/form.js');
drupal_add_js('misc/collapse.js');
$islandora_object = $variables['islandora_object']; $islandora_object = $variables['islandora_object'];
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core'); module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
try { try {
@ -209,25 +211,6 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); 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_dublin_core'] = $dc_object;
//create a nicer array for themers
//TODO: give this a better home
//$dc_array = array();
//foreach ($dc_object as $element) {
// if (!empty($element)) {
// foreach ($element as $field => $value) {
// // split value if the result value is an array
// if (is_array($value)) {
// $value = implode(", ", $value);
// }
// $dc_label = explode(':', $field);
// $element_label = ucfirst($dc_label[1]);
// $dc_array[$field]['label'] = $element_label;
// $dc_array[$field]['value'] = strip_tags($value);
// $dc_array[$field]['class'] = strtolower( preg_replace('/[^A-Za-z0-9]/', '-', $field));
// }
// }
//}
$variables['dc_array'] = $dc_object->as_formatted_array(); $variables['dc_array'] = $dc_object->as_formatted_array();
$variables['islandora_object_label'] = $islandora_object->label; $variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id); $variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id);

Loading…
Cancel
Save