Browse Source

Coder cleanup. Also pcdm:File mapping hook

7.x-2.x
Daniel Lamb 10 years ago
parent
commit
23b2b5f1a1
  1. 2
      islandora/include/fields.inc
  2. 2
      islandora/include/rdf_mapping.inc
  3. 23
      islandora/islandora.api.php
  4. 1
      islandora/islandora.module
  5. 4
      islandora_collection/islandora_collection.module
  6. 13
      islandora_mods/islandora_mods.module

2
islandora/include/fields.inc

@ -84,7 +84,7 @@ function islandora_add_field_to_bundle($bundle_name, $field_name, $field_label,
* @param array $field_definition
* Field definition for the desired field.
*/
function islandora_create_field($field_definition) {
function islandora_create_field(array $field_definition) {
// If this gets called from an install hook, we can't guarantee the t's
// existance.
$t = get_t();

2
islandora/include/rdf_mapping.inc

@ -16,7 +16,7 @@
* @return array
* The default RDF mapping for Islandora content types.
*/
function islandora_get_default_rdf_mapping($bundle, $rdf_types) {
function islandora_get_default_rdf_mapping($bundle, array $rdf_types) {
$default_rdf_types = array(
'ldp:RDFSource',
'ldp:Container',

23
islandora/islandora.api.php

@ -0,0 +1,23 @@
<?php
/**
* @file
* Hooks provided by Islandora.
*/
/**
* Hook to collect pcdm:File to field mappings.
*
* @return array
* An associative array, where keys are the name of the field and the values
* are dc:identifier of the associated pcdm:File (e.g. DSID for those using
* the old vocabulary).
*/
function hook_pcdm_file_mapping() {
return array(
'field_mods' => array(
'id' => 'MODS',
'mimetype' => 'application/xml',
),
);
}

1
islandora/islandora.module

@ -62,6 +62,7 @@ function islandora_entity_load($entities, $type) {
foreach ($entities as $entity) {
if (strcmp($type, "node") == 0) {
$entity->rdf_namespaces = rdf_get_namespaces();
$entity->pcdm_file_mapping = module_invoke_all("pcdm_file_mapping");
}
}
}

4
islandora_collection/islandora_collection.module

@ -55,7 +55,6 @@ function islandora_collection_rdf_mapping() {
*/
function islandora_collection_node_postinsert($node) {
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
dd("IGNORING HOOK!");
return;
}
@ -78,16 +77,13 @@ function islandora_collection_node_postinsert($node) {
'data' => json_encode($node),
));
$response = httprl_send_request();
dd($response);
}
/**
* Implements hook_update().
*/
function islandora_collection_node_postupdate($node) {
dd("FROM POST UPDATE HOOK");
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
dd("IGNORING HOOK!");
return;
}
}

13
islandora_mods/islandora_mods.module

@ -10,6 +10,7 @@ define('ISLANDORA_MODS_NAMESPACE_PREFIX', 'mods');
define('ISLANDORA_MODS_RDF_NAMESPACE', 'http://www.loc.gov/mods/modsrdf/v1#');
define('ISLANDORA_MODS_RDF_NAMESPACE_PREFIX', 'modsrdf');
define('ISLANDORA_MODS_FIELD', 'field_mods');
define('ISLANDORA_MODS_FILE_ID', 'MODS');
/**
* Implements hook_rdf_namespaces().
@ -19,3 +20,15 @@ function islandora_mods_rdf_namespaces() {
ISLANDORA_MODS_RDF_NAMESPACE_PREFIX => ISLANDORA_MODS_RDF_NAMESPACE,
);
}
/**
* Implements hook_pcdm_file_mapping().
*/
function islandora_mods_pcdm_file_mapping() {
return array(
ISLANDORA_MODS_FIELD => array(
'id' => ISLANDORA_MODS_FILE_ID,
'mimetype' => 'application/xml',
),
);
}

Loading…
Cancel
Save