Commit f006bce6 authored by Mark Jordan's avatar Mark Jordan
Browse files

Initial commit.

parents
This diff is collapsed.
# Islandora OAI Cleanup
## Introduction
## Requirements
* [Islandora OAI](https://github.com/Islandora/islandora_oai)
## Installation
Install as usual, see [this](https://drupal.org/documentation/install/modules-themes/modules-7) for further information.
## Configuration
There are no configuration options.
## Maintainer
* [Mark Jordan](https://github.com/mjordan)
## License
* [GPLv3](http://www.gnu.org/licenses/gpl-3.0.txt)
name = "Islandora OAI-PMH Cleanup"
description = "Utility module that removes elements from MODS before it is exposed via OAI-PMH."
version = 7.x-dev
core = 7.x
package = Islandora Tools
dependencies[] = islandora_oai
<?php
/**
* @file
* The main Islandora Metadata Extras module file.
*/
/**
* Implements hook_islandora_oai_record_alter().
*/
function islandora_oai_cleanup_islandora_oai_record_alter(&$oai_record, &$params) {
if ($params['metadata_prefix'] == 'mods') {
$dom = new DOMDocument();
$dom->preserveWhiteSpace = FALSE;
$dom->formatOutput = TRUE;
$dom->loadXML($oai_record);
$mods = $dom->getElementsByTagNameNS('http://www.loc.gov/mods/v3', 'mods');
$extensions = $dom->getElementsByTagNameNS('http://www.loc.gov/mods/v3', 'extension');
foreach ($extensions as $extension) {
$mods->item(0)->removeChild($extension);
}
$oai_record = $dom->saveXML($dom->documentElement);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment