Browse Source

And now it works.

7.x-2.x
Daniel Lamb 10 years ago
parent
commit
ffc6f0dac8
  1. 15
      islandora/include/fields.inc
  2. 4
      islandora/include/rdf_mapping.inc
  3. 2
      islandora/islandora.info
  4. 10
      islandora/islandora.install
  5. 1
      islandora/islandora.module
  6. 10
      islandora_basic_image/islandora_basic_image.install
  7. 4
      islandora_collection/islandora_collection.install
  8. 10
      islandora_dc/include/fields.inc
  9. 4
      islandora_dc/islandora_dc.install
  10. 6
      islandora_mods/include/fields.inc
  11. 6
      islandora_mods/islandora_mods.install

15
islandora/include/fields.inc

@ -22,6 +22,10 @@ function islandora_add_fields_to_bundle($bundle_name) {
'label' => 'Thumbnail',
'description' => 'Thumbnail image',
),
ISLANDORA_FEDORA_PATH_FIELD => array(
'label' => 'Fedora Path',
'description' => 'Path to resource in Fedora 4',
),
ISLANDORA_FEDORA_HAS_PARENT_FIELD => array(
'label' => 'fedora:hasParent',
'description' => 'Parent resource in Fedora 4',
@ -29,6 +33,7 @@ function islandora_add_fields_to_bundle($bundle_name) {
ISLANDORA_PCDM_HAS_MEMBER_FIELD => array(
'label' => 'pcdm:hasMember',
'description' => 'Child resources in Fedora 4',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
),
);
@ -42,15 +47,15 @@ function islandora_add_fields_to_bundle($bundle_name) {
'field_name' => $field_name,
'entity_type' => 'node',
'bundle' => $bundle_name,
'label' => $t("%label", array("%description" => $field_label)),
'description' => $t("%description", array("%description" => $field_description)),
'label' => $t("@label", array("@label" => $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',
$message = $t('Field @name was added to @bundle successfully',
array(
'%name' => $field_name,
'%bundle' => $bundle_name,
'@name' => $field_name,
'@bundle' => $bundle_name,
));
drupal_set_message($message);
}

4
islandora/include/rdf_mapping.inc

@ -27,11 +27,11 @@ function islandora_get_default_rdf_mapping($bundle, $rdf_type) {
'predicates' => array('dc11:identifier'),
'datatype' => 'xsd:ID',
),
ISLANDORA_FEDORA_HAS_PARENT => array(
ISLANDORA_FEDORA_HAS_PARENT_FIELD => array(
'predicates' => array('fedora:hasParent'),
'datatype' => 'xsd:string',
),
ISLANDORA_PCDM_HAS_MEMBER => array(
ISLANDORA_PCDM_HAS_MEMBER_FIELD => array(
'predicates' => array('pcdm:hasMember'),
'datatype' => 'xsd:string',
),

2
islandora/islandora.info

@ -11,3 +11,5 @@ dependencies[] = views_ui
dependencies[] = rdfui
dependencies[] = xml_field
dependencies[] = xpath_field
dependencies[] = islandora_dc
dependencies[] = islandora_mods

10
islandora/islandora.install

@ -11,27 +11,37 @@
* Defines common fields for various bundles.
*/
function islandora_install() {
$t = get_t();
$tn_field = array(
'field_name' => ISLANDORA_TN_FIELD,
'type' => 'image',
);
field_create_field($tn_field);
drupal_set_message($t("Created field @field",
array("@field" => ISLANDORA_TN_FIELD)));
$fedora_path_field = array(
'field_name' => ISLANDORA_FEDORA_PATH_FIELD,
'type' => 'text',
);
field_create_field($fedora_path_field);
drupal_set_message($t("Created field @field",
array("@field" => ISLANDORA_FEDORA_PATH_FIELD)));
$fedora_has_parent_field = array(
'field_name' => ISLANDORA_FEDORA_HAS_PARENT_FIELD,
'type' => 'text',
);
field_create_field($fedora_has_parent_field);
drupal_set_message($t("Created field @field",
array("@field" => ISLANDORA_FEDORA_HAS_PARENT_FIELD)));
$pcdm_has_member_field = array(
'field_name' => ISLANDORA_PCDM_HAS_MEMBER_FIELD,
'type' => 'text',
);
field_create_field($pcdm_has_member_field);
drupal_set_message($t("Created field @field",
array("@field" => ISLANDORA_PCDM_HAS_MEMBER_FIELD)));
}

1
islandora/islandora.module

@ -9,6 +9,7 @@ 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_FEDORA_PATH_FIELD', 'field_fedora_path');
define('ISLANDORA_FEDORA_HAS_PARENT_FIELD', 'field_fedora_has_parent');
define('ISLANDORA_PCDM_HAS_MEMBER_FIELD', 'field_pcdm_has_member');

10
islandora_basic_image/islandora_basic_image.install

@ -9,7 +9,7 @@
* Implements hook_install().
*/
function islandora_basic_image_install() {
module_load_include('inc', 'islandora', 'include/fields.inc');
module_load_include('inc', 'islandora', 'include/fields');
// Ensure the basic image node type is available.
node_types_rebuild();
@ -22,6 +22,8 @@ function islandora_basic_image_install() {
'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)) {
@ -34,7 +36,11 @@ function islandora_basic_image_install() {
'required' => FALSE,
);
field_create_instance($medium_size_field_instance);
drupal_set_message($t('Field %name was created successfully', array('%name' => ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD)));
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);

4
islandora_collection/islandora_collection.install

@ -9,14 +9,14 @@
* Implements hook_install().
*/
function islandora_collection_install() {
module_load_include('inc', 'islandora', 'include/fields.inc');
module_load_include('inc', 'islandora', 'include/fields');
module_load_include('inc', 'islandora_collection', 'include/relations');
// Ensure the collection node type is available.
node_types_rebuild();
// Add default Islandora fields.
islandora_add_fields_to_bundle(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE);
islandora_add_fields_to_bundle(ISLANDORA_COLLECTION_CONTENT_TYPE);
// Create the pcdm:hasMember relation.
islandora_collection_define_relations();

10
islandora_dc/include/fields.inc

@ -91,15 +91,15 @@ function islandora_dc_add_fields_to_bundle($bundle_name) {
'field_name' => $field_name,
'entity_type' => 'node',
'bundle' => $bundle_name,
'label' => $t("%label", array("%description" => $field_label)),
'description' => $t("%description", array("%description" => $field_description)),
'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',
$message = $t('Field @name was successfully added to @bundle',
array(
'%name' => $field_name,
'%bundle' => $bundle_name,
'@name' => $field_name,
'@bundle' => $bundle_name,
));
drupal_set_message($message);
}

4
islandora_dc/islandora_dc.install

@ -11,6 +11,8 @@
* Creates shared fields for content types using DC metadata.
*/
function islandora_dc_install() {
$t = get_t();
$field_names = array(
ISLANDORA_DC_CONTRIBUTOR_FIELD,
ISLANDORA_DC_COVERAGE_FIELD,
@ -36,5 +38,7 @@ function islandora_dc_install() {
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
);
field_create_field($field);
drupal_set_message($t("Created field @field",
array("@field" => $field_name)));
}
}

6
islandora_mods/include/fields.inc

@ -26,10 +26,10 @@ function islandora_mods_add_fields_to_bundle($bundle_name) {
'required' => FALSE,
);
field_create_instance($mods_field_instance);
$message = $t('Field %name was successfully added to %bundle',
$message = $t('Field @name was successfully added to @bundle',
array(
'%name' => ISLANDORA_MODS_FIELD,
'%bundle' => $bundle_name,
'@name' => ISLANDORA_MODS_FIELD,
'@bundle' => $bundle_name,
));
drupal_set_message($message);
}

6
islandora_mods/islandora_mods.install

@ -10,10 +10,14 @@
*
* Creates shared fields for content types using MODS metadata.
*/
function islandora_dc_install() {
function islandora_mods_install() {
$t = get_t();
$mods_field = array(
'field_name' => ISLANDORA_MODS_FIELD,
'type' => 'xml_field_xml',
);
field_create_field($mods_field);
drupal_set_message($t("Created field @field",
array("@field" => ISLANDORA_MODS_FIELD)));
}

Loading…
Cancel
Save