You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
10 years ago
|
<?php
|
||
|
|
||
|
/**
|
||
|
* @file
|
||
10 years ago
|
* Utility functions for attaching default fields to collections.
|
||
10 years ago
|
*/
|
||
|
|
||
|
/**
|
||
10 years ago
|
* Attaches default fields for this module's content type.
|
||
10 years ago
|
*/
|
||
10 years ago
|
function islandora_collection_attach_default_fields() {
|
||
10 years ago
|
$t = get_t();
|
||
|
|
||
|
// Add thumbnail field.
|
||
|
if (field_info_field(ISLANDORA_TN_FIELD)) {
|
||
|
$tn_field_instance = array(
|
||
|
'field_name' => ISLANDORA_TN_FIELD,
|
||
|
'entity_type' => 'node',
|
||
10 years ago
|
'bundle' => ISLANDORA_COLLECTION_CONTENT_TYPE,
|
||
10 years ago
|
'label' => $t("Thumbnail"),
|
||
|
'description' => $t("A thumbnail for the Fedora resource"),
|
||
|
'required' => FALSE,
|
||
|
);
|
||
|
field_create_instance($tn_field_instance);
|
||
|
drupal_set_message($t('Field %name was created successfully', array('%name' => ISLANDORA_TN_FIELD)));
|
||
|
}
|
||
|
|
||
|
// Add MODS field.
|
||
|
if (field_info_field(ISLANDORA_MODS_FIELD)) {
|
||
|
$mods_field_instance = array(
|
||
|
'field_name' => ISLANDORA_MODS_FIELD,
|
||
|
'entity_type' => 'node',
|
||
10 years ago
|
'bundle' => ISLANDORA_COLLECTION_CONTENT_TYPE,
|
||
10 years ago
|
'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)));
|
||
|
}
|
||
|
}
|