Browse Source

added formatted array output to dublin core class

pull/110/merge
Paul Pound 13 years ago
parent
commit
256a901303
  1. 19
      includes/islandora_dublin_core.inc
  2. 19
      islandora_basic_image/islandora_basic_image.module

19
includes/islandora_dublin_core.inc

@ -99,6 +99,25 @@ class Dublin_Core {
}
function as_formatted_array() {
$dc_array = array();
foreach ($this->dc 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));
}
}
}
return $dc_array;
}
/**

19
islandora_basic_image/islandora_basic_image.module

@ -101,24 +101,7 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
$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_array;
$variables['dc_array'] = $dc_object->as_formatted_array();
$variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id);
global $base_url;

Loading…
Cancel
Save