|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* This file contains all install related hooks.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_install().
|
|
|
|
*/
|
|
|
|
function islandora_basic_image_install() {
|
|
|
|
module_load_include('inc', 'islandora', 'include/fields');
|
|
|
|
|
|
|
|
// Ensure the basic image node type is available.
|
|
|
|
node_types_rebuild();
|
|
|
|
|
|
|
|
$t = get_t();
|
|
|
|
|
|
|
|
// Create medium size field.
|
|
|
|
$medium_size_field = array(
|
|
|
|
'field_name' => ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD,
|
|
|
|
'type' => 'image',
|
|
|
|
);
|
|
|
|
field_create_field($medium_size_field);
|
|
|
|
drupal_set_message($t("Created field @field",
|
|
|
|
array("@field" => ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD)));
|
|
|
|
|
|
|
|
// Add fields instances to bundle.
|
|
|
|
if (field_info_field(ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD)) {
|
|
|
|
$medium_size_field_instance = array(
|
|
|
|
'field_name' => ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD,
|
|
|
|
'entity_type' => 'node',
|
|
|
|
'bundle' => ISLANDORA_BASIC_IMAGE_CONTENT_TYPE,
|
|
|
|
'label' => $t("Medium Size"),
|
|
|
|
'description' => $t("A display copy of the image."),
|
|
|
|
'required' => FALSE,
|
|
|
|
);
|
|
|
|
field_create_instance($medium_size_field_instance);
|
|
|
|
drupal_set_message($t('Field @name was successfully added to @bundle',
|
|
|
|
array(
|
|
|
|
'@name' => ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD,
|
|
|
|
'@bundle' => ISLANDORA_BASIC_IMAGE_CONTENT_TYPE,
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
islandora_add_fields_to_bundle(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE);
|
|
|
|
}
|