diff --git a/islandora/include/fields.inc b/islandora/include/fields.inc new file mode 100644 index 00000000..ad4c8d4c --- /dev/null +++ b/islandora/include/fields.inc @@ -0,0 +1,58 @@ + array( + 'label' => 'Thumbnail', + 'description' => 'Thumbnail image', + ), + ISLANDORA_FEDORA_HAS_PARENT_FIELD => array( + 'label' => 'fedora:hasParent', + 'description' => 'Parent resource in Fedora 4', + ), + ISLANDORA_PCDM_HAS_MEMBER_FIELD => array( + 'label' => 'pcdm:hasMember', + 'description' => 'Child resources in Fedora 4', + ), + ); + + // Iterate over fields and add each to the specified bundle. + foreach ($field_data as $field_name => $data) { + $field_label = $data['label']; + $field_description = $data['description']; + + if (field_info_field($field_name)) { + $field_instance = array( + 'field_name' => $field_name, + 'entity_type' => 'node', + 'bundle' => $bundle_name, + 'label' => $t("%label", array("%description" => $field_label)), + 'description' => $t("%description", array("%description" => $field_description)), + 'required' => FALSE, + ); + field_create_instance($field_instance); + $message = $t('Field %name was added to %bundle successfully', + array( + '%name' => $field_name, + '%bundle' => $bundle_name, + )); + drupal_set_message($message); + } + } +} diff --git a/islandora/islandora.install b/islandora/islandora.install index 4741c421..6735ddd4 100644 --- a/islandora/islandora.install +++ b/islandora/islandora.install @@ -17,12 +17,6 @@ function islandora_install() { ); field_create_field($tn_field); - $mods_field = array( - 'field_name' => ISLANDORA_MODS_FIELD, - 'type' => 'xml_field_xml', - ); - field_create_field($mods_field); - $fedora_path_field = array( 'field_name' => ISLANDORA_FEDORA_PATH_FIELD, 'type' => 'text', diff --git a/islandora/islandora.module b/islandora/islandora.module index 41aee40b..018e7f77 100644 --- a/islandora/islandora.module +++ b/islandora/islandora.module @@ -9,9 +9,8 @@ define('ISLANDORA_NAMESPACE', 'http://islandora.ca/ontology/v2/'); define('ISLANDORA_FEDORA_NAMESPACE', 'http://fedora.info/definitions/v4/repository#'); define('ISLANDORA_PCDM_NAMESPACE', 'http://pcdm.org/models#'); define('ISLANDORA_TN_FIELD', 'field_tn'); -define('ISLANDORA_MODS_FIELD', 'field_mods'); -define('ISLANDORA_FEDORA_HAS_PARENT', 'field_fedora_has_parent'); -define('ISLANDORA_PCDM_HAS_MEMBER', 'field_pcdm_has_member'); +define('ISLANDORA_FEDORA_HAS_PARENT_FIELD', 'field_fedora_has_parent'); +define('ISLANDORA_PCDM_HAS_MEMBER_FIELD', 'field_pcdm_has_member'); /** * Implements hook_ctools_plugin_api(). diff --git a/islandora_basic_image/islandora_basic_image.install b/islandora_basic_image/islandora_basic_image.install index c2644cc3..02b96efc 100644 --- a/islandora_basic_image/islandora_basic_image.install +++ b/islandora_basic_image/islandora_basic_image.install @@ -47,17 +47,4 @@ function islandora_basic_image_install() { field_create_instance($tn_field_instance); drupal_set_message($t('Field %name was created successfully', array('%name' => ISLANDORA_TN_FIELD))); } - - if (field_info_field(ISLANDORA_MODS_FIELD)) { - $mods_field_instance = array( - 'field_name' => ISLANDORA_MODS_FIELD, - 'entity_type' => 'node', - 'bundle' => ISLANDORA_BASIC_IMAGE_CONTENT_TYPE, - 'label' => $t("MODS"), - 'description' => $t("A MODS record for the Fedora resource"), - 'required' => FALSE, - ); - field_create_instance($mods_field_instance); - drupal_set_message($t('Field %name was created successfully', array('%name' => ISLANDORA_MODS_FIELD))); - } } diff --git a/islandora_dc/include/fields.inc b/islandora_dc/include/fields.inc index 52d8f5bf..28952381 100644 --- a/islandora_dc/include/fields.inc +++ b/islandora_dc/include/fields.inc @@ -99,7 +99,7 @@ function islandora_dc_add_fields_to_bundle($bundle_name) { $message = $t('Field %name was added to %bundle successfully', array( '%name' => $field_name, - '%bundle' => $bundle, + '%bundle' => $bundle_name, )); drupal_set_message($message); } diff --git a/islandora_dc/islandora_dc.module b/islandora_dc/islandora_dc.module index 64fdd167..f3cd6c7c 100644 --- a/islandora_dc/islandora_dc.module +++ b/islandora_dc/islandora_dc.module @@ -22,3 +22,12 @@ define('ISLANDORA_DC_SOURCE_FIELD', 'field_dc_source'); define('ISLANDORA_DC_SUBJECT_FIELD', 'field_dc_subject'); define('ISLANDORA_DC_TITLE_FIELD', 'field_dc_title'); define('ISLANDORA_DC_TYPE_FIELD', 'field_dc_type'); + +/** + * Implements hook_rdf_namespaces(). + */ +function islandora_dc_rdf_namespaces() { + return array( + ISLANDORA_DC_NAMESPACE_PREFIX => ISLANDORA_DC_NAMESPACE, + ); +} diff --git a/islandora_mods/include/fields.inc b/islandora_mods/include/fields.inc new file mode 100644 index 00000000..2ccfd631 --- /dev/null +++ b/islandora_mods/include/fields.inc @@ -0,0 +1,36 @@ + ISLANDORA_MODS_FIELD, + 'entity_type' => 'node', + 'bundle' => $bundle_name, + 'label' => $t("MODS XML"), + 'description' => $t("A MODS record for the Fedora resource"), + 'required' => FALSE, + ); + field_create_instance($mods_field_instance); + $message = $t('Field %name was successfully added to %bundle', + array( + '%name' => ISLANDORA_MODS_FIELD, + '%bundle' => $bundle_name, + )); + drupal_set_message($message); + } +} diff --git a/islandora_mods/islandora_mods.info b/islandora_mods/islandora_mods.info new file mode 100644 index 00000000..eb13af06 --- /dev/null +++ b/islandora_mods/islandora_mods.info @@ -0,0 +1,5 @@ +name = Islandora MODS +description = "Fields and utilities for managing MODS metadata in Islandora" +package = Islandora +version = 7.x-dev +core = 7.x diff --git a/islandora_mods/islandora_mods.install b/islandora_mods/islandora_mods.install new file mode 100644 index 00000000..46f4412d --- /dev/null +++ b/islandora_mods/islandora_mods.install @@ -0,0 +1,19 @@ + ISLANDORA_MODS_FIELD, + 'type' => 'xml_field_xml', + ); + field_create_field($mods_field); +} diff --git a/islandora_mods/islandora_mods.module b/islandora_mods/islandora_mods.module new file mode 100644 index 00000000..ff9b53dd --- /dev/null +++ b/islandora_mods/islandora_mods.module @@ -0,0 +1,21 @@ + ISLANDORA_MODS_RDF_NAMESPACE, + ); +}