From eda2bf948f14ae87c3712d897a819087ca6ad9d0 Mon Sep 17 00:00:00 2001 From: Daniel Lamb Date: Mon, 13 Apr 2015 17:33:45 +0000 Subject: [PATCH] Added a thumbnail field --- islandora/islandora.install | 20 +++++++++++++++++++ .../islandora_basic_image.install | 18 +++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 islandora/islandora.install diff --git a/islandora/islandora.install b/islandora/islandora.install new file mode 100644 index 00000000..aada7f1d --- /dev/null +++ b/islandora/islandora.install @@ -0,0 +1,20 @@ + $tn_field_name, + 'type' => 'image', + ); + field_create_field($tn_field); +} + +function islandora_uninstall() { + $tn_field_name = 'field_tn'; + field_delete_field($tn_field_name); +} diff --git a/islandora_basic_image/islandora_basic_image.install b/islandora_basic_image/islandora_basic_image.install index ae877c09..23e360ad 100644 --- a/islandora_basic_image/islandora_basic_image.install +++ b/islandora_basic_image/islandora_basic_image.install @@ -23,8 +23,26 @@ 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)) { + $tn_field_instance = array( + 'field_name' => $tn_field_name, + 'entity_type' => 'node', + 'bundle' => 'basic_image', + '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))); + } } function islandora_basic_image_uninstall() { + field_delete_instance(field_info_instance('node_content', 'field_tn', 'basic_image')); node_type_delete('basic_image'); }