Last active
February 21, 2017 04:05
-
-
Save mjordan/f6eefe4e95d66bad535fb78dcfd82ea4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_islandora_datastream_alter(). | |
*/ | |
function mjtest_islandora_datastream_alter(AbstractObject $object, AbstractDatastream $datastream, array &$context) { | |
$now = date("Y-m-d H:i:s"); | |
$dc = <<<EOX | |
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> | |
<dc:title>Testing at $now</dc:title> | |
<dc:description>I am concocted.</dc:description> | |
</oai_dc:dc> | |
EOX; | |
if ($context['action'] == 'ingest') { | |
if ($object['DC'] && $datastream->id == 'DC') { | |
$datastream->setContentFromString($dc); | |
} | |
} | |
if ($context['action'] == 'modify') { | |
if ($object['DC'] && $datastream->id == 'DC') { | |
if (isset($context['params']['dsString'])) { | |
$context['params']['dsString'] = $dc; | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment