Digital.Grinnell has seen a lot of customization over the years, and quite a bit of it relates to how an object’s metadata, especially its MODS metadata, is displayed. My aim for the past couple of years has been to remove as much customization as possible, but I’ve found it difficult to remove features of our MODS display because those features seem to be rather popular. This is particulary true of our compound object display.

Custom Compound/Child MODS Display

At present, May 28, 2020, the MODS display for a typical compound/child object in Digital.Grinnell looks something like the example image from grinnell:10365 included here:

grinnell:10365 MODS Example

The display feature demonstrated above is supposed to “hide” any field in the child object, the first 8 lines of metadata that appear above the “Group Record”, which are identical to the same field in the parent/compound object, the lines below the “Group Record” heading. This rule applies to all fields except “Title” and “Supporting Hoste”, but if you look closely at the image above you’ll see there are some duplicates displayed, specifically:

  • Related Item: Digital Grinnell
  • Language: English
  • Access Condition: Copyright to this work…

Details

The process of hiding “duplicate” metadata from a child/parent object pair is relatively simple, but it involves some XSL transformations (XSLT), so it’s inherently messy. The heavy-lifting all takes place in Digital.Grinnell’s islandora_mods_display module.

XSL Transform

The aforementioned transform happens in a “hook” function called islandora_mods_display_preprocess_islandora_mods_display_display that can be found in theme.inc. The .xsl file used in the transform is mods_display.xsl. The “merging” of child/parent metadata happens inside the aforementioned function.

Hidden Elements

Another function, islandora_mods_display_remove_redundant_rows, from theme.inc hides redundant rows by applying a CSS class named hidden to the <tr> elements of the child object MODS that have identical counterparts in the parent’s MODS metadata.

Fixing the Displayed Duplicates

Found it, and fixed it too! The islandora_mods_display_remove_redundant_rows code in theme.inc added the hidden class to <tr> elements like so:

$elements[$i] = str_replace('<tr>', '<tr class="hidden">', $elements[$i]);

The problem with that statement is that some table rows now have xmlns:xlink attributes due to the recent addition of live links in some metadata fields. As a result, those fields that now support live links could not be “hidden”. The same code now reads like so:

$elements[$i] = str_replace('<tr', '<tr class="hidden"', $elements[$i]);

Note that the closing carret has been removed from both the search string and the replacement. It works! Yay❗ As a result, the same object metadata shown above now looks like this:

grinnell:10365 MODS Example - Corrected

And that’s a wrap. Until next time, stay safe and wash your hands! 😄