Skip to content

Instantly share code, notes, and snippets.

@nhart
Created July 25, 2013 13:30
Show Gist options
  • Save nhart/6079631 to your computer and use it in GitHub Desktop.
Save nhart/6079631 to your computer and use it in GitHub Desktop.
/**
* Implements hook_preprocess().
*/
function your_theme_preprocess_islandora_basic_image(&$variables) {
mods_metadata($variables);
}
/*
* Use a MODS to HTML xslt for the metadata fieldset
*/
function mods_metadata(&$variables) {
$object = $variables['islandora_object'];
if ($object['MODS']) {
$mods = new SimpleXMLElement($object['MODS']->content);
$path = drupal_get_path("theme", "your_theme");
$xsl = simplexml_load_file("$path/xslt/your-mods.xsl");
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
$mods_table_html = $proc->transformToXML($mods);
$form = array();
$form['mods_table'] = array(
'#type' => 'markup',
'#markup' => $mods_table_html,
);
$variables['metadata_table'] = drupal_render($form);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment