Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created October 23, 2012 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyboggs/3941122 to your computer and use it in GitHub Desktop.
Save jeremyboggs/3941122 to your computer and use it in GitHub Desktop.
Changes different heads for various DC fields.
<div class="element-set">
<h2><?php echo html_escape(__($setName)); ?></h2>
<?php foreach ($elementsInSet as $info):
$elementName = $info['elementName'];
if ($setName == 'Dublin Core') {
switch($elementName) {
// Check if $elementName is 'Description'
case 'Description':
$elementName = 'Header'; // Change value of $elementName to 'Header'
break;
// Check if $elementName is 'Relation'
case 'Relation':
$elementName = 'Further Reading'; // Change value to 'Further Reading'
break;
// Check if $elementName is 'Text'
case 'Text':
$elementName = 'Further Reading';
break;
// Leave the default for headings you don't want to change.
default:
$elementName = $elementName;
}
}
$elementRecord = $info['element'];
if ($info['isShowable']): ?>
<div id="<?php echo text_to_id(html_escape("$setName $elementName")); ?>" class="element">
<h3><?php echo html_escape(__($elementName)); ?></h3>
<?php if ($info['isEmpty']): ?>
<div class="element-text-empty"><?php echo __($info['emptyText']); ?></div>
<?php else: ?>
<?php
// We need to extract the element set name from the record b/c
// $setName contains the 'pretty' version of it that may be named differently
// than the actual element set.
?>
<?php foreach ($info['texts'] as $text): ?>
<div class="element-text"><?php echo $text; ?></div>
<?php endforeach; ?>
<?php endif; ?>
</div><!-- end element -->
<?php endif; ?>
<?php endforeach; ?>
</div><!-- end element-set -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment