diff --git a/islandora/islandora.install b/islandora/islandora.install index 9fdb765c..0dd5a20b 100644 --- a/islandora/islandora.install +++ b/islandora/islandora.install @@ -11,18 +11,32 @@ * Defines common fields for various bundles. */ function islandora_install() { - $tn_field_name = 'field_tn'; $tn_field = array( - 'field_name' => $tn_field_name, + 'field_name' => ISLANDORA_TN_FIELD, 'type' => 'image', ); field_create_field($tn_field); + + $dc_field = array( + 'field_name' => ISLANDORA_DC_FIELD, + 'type' => 'xml_field_xml', + ); + field_create_field($dc_field); + + $mods_field = array( + 'field_name' => ISLANDORA_MODS_FIELD, + 'type' => 'xml_field_xml', + ); + field_create_field($mods_field); } /** * Implements hook_uninstall(). + * + * Deletes the fields defined in hook_install(). */ function islandora_uninstall() { - $tn_field_name = 'field_tn'; - field_delete_field($tn_field_name); + field_delete_field(ISLANDORA_TN_FIELD); + field_delete_field(ISLANDORA_DC_FIELD); + field_delete_field(ISLANDORA_MODS_FIELD); } diff --git a/islandora/islandora.module b/islandora/islandora.module index 99cab66e..3ea7035f 100644 --- a/islandora/islandora.module +++ b/islandora/islandora.module @@ -5,6 +5,10 @@ * This is the new Islandora module. We need a better doc comment here. */ +define('ISLANDORA_TN_FIELD', 'field_tn'); +define('ISLANDORA_DC_FIELD', 'field_dc'); +define('ISLANDORA_MODS_FIELD', 'field_mods'); + /** * Implements hook_ctools_plugin_api(). */ diff --git a/islandora_basic_image/islandora_basic_image.install b/islandora_basic_image/islandora_basic_image.install index f99cbc51..4cda98a4 100644 --- a/islandora_basic_image/islandora_basic_image.install +++ b/islandora_basic_image/islandora_basic_image.install @@ -12,10 +12,14 @@ function islandora_basic_image_install() { $t = get_t(); $basic_image_content_type = array( - 'type' => 'basic_image', + 'type' => ISLANDORA_BASIC_IMAGE_BUNDLE, 'name' => $t('Basic Image'), 'base' => 'node_content', 'description' => $t('An image object in Fedora'), + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + 'disabled' => 0, ); $basic_image_content_type = node_type_set_defaults($basic_image_content_type); @@ -31,22 +35,43 @@ function islandora_basic_image_install() { drupal_set_message($t('Created %name content type.', $t_args)); } - $tn_field_name = 'field_tn'; - if (field_info_field($tn_field_name)) { + if (field_info_field(ISLANDORA_TN_FIELD)) { $tn_field_instance = array( - 'field_name' => $tn_field_name, + 'field_name' => ISLANDORA_TN_FIELD, 'entity_type' => 'node', - 'bundle' => 'basic_image', + 'bundle' => ISLANDORA_BASIC_IMAGE_BUNDLE, 'label' => $t("Thumbnail"), 'description' => $t("A thumbnail for the Fedora resource"), 'required' => FALSE, - 'settings' => array( - 'file_extensions' => 'png jpg jpeg gif', - 'max_filesize' => '1 MB', - ), ); field_create_instance($tn_field_instance); - drupal_set_message($t('Field %name was created successfully', array('%name' => $tn_field_name))); + drupal_set_message($t('Field %name was created successfully', array('%name' => ISLANDORA_TN_FIELD))); + } + + if (field_info_field(ISLANDORA_DC_FIELD)) { + $dc_field_instance = array( + 'field_name' => ISLANDORA_DC_FIELD, + 'entity_type' => 'node', + 'bundle' => ISLANDORA_BASIC_IMAGE_BUNDLE, + 'label' => $t("DC"), + 'description' => $t("A Dublin Core record for the Fedora resource"), + 'required' => FALSE, + ); + field_create_instance($dc_field_instance); + drupal_set_message($t('Field %name was created successfully', array('%name' => ISLANDORA_DC_FIELD))); + } + + if (field_info_field(ISLANDORA_MODS_FIELD)) { + $mods_field_instance = array( + 'field_name' => ISLANDORA_MODS_FIELD, + 'entity_type' => 'node', + 'bundle' => ISLANDORA_BASIC_IMAGE_BUNDLE, + '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))); } } @@ -54,6 +79,8 @@ function islandora_basic_image_install() { * Implements hook_uninstall(). */ function islandora_basic_image_uninstall() { - field_delete_instance(field_info_instance('node_content', 'field_tn', 'basic_image')); - node_type_delete('basic_image'); + field_delete_instance(field_info_instance('node_content', ISLANDORA_TN_FIELD, ISLANDORA_BASIC_IMAGE_BUNDLE)); + field_delete_instance(field_info_instance('node_content', ISLANDORA_DC_FIELD, ISLANDORA_BASIC_IMAGE_BUNDLE)); + field_delete_instance(field_info_instance('node_content', ISLANDORA_MODS_FIELD, ISLANDORA_BASIC_IMAGE_BUNDLE)); + node_type_delete(ISLANDORA_BASIC_IMAGE_BUNDLE); } diff --git a/islandora_basic_image/islandora_basic_image.module b/islandora_basic_image/islandora_basic_image.module index ad77989a..0382d871 100644 --- a/islandora_basic_image/islandora_basic_image.module +++ b/islandora_basic_image/islandora_basic_image.module @@ -5,6 +5,8 @@ * This is the new Islandora Basic Image module. */ +define('ISLANDORA_BASIC_IMAGE_BUNDLE', 'basic_image'); + /** * Function for using a form. *