Browse Source

Fixed changed hook for adding fields/instances to bundles

Stephen Ficklin 8 years ago
parent
commit
52c128fcb4
2 changed files with 9 additions and 9 deletions
  1. 6 6
      tripal/api/tripal.entities.api.inc
  2. 3 3
      tripal/includes/tripal_admin_usage_page.inc

+ 6 - 6
tripal/api/tripal.entities.api.inc

@@ -331,7 +331,7 @@ function tripal_create_bundle($args, &$error = '') {
     $bundle = tripal_load_bundle_entity(array('name' => $bundle_name));
 
     // Allow modules to add fields to the new bundle.
-    $modules = module_implements('bundle_create_fields');
+    $modules = module_implements('bundle_fields_info');
     foreach ($modules as $module) {
       $function = $module . '_bundle_fields_info';
       $info = $function('TripalEntity', $bundle);
@@ -357,7 +357,7 @@ function tripal_create_bundle($args, &$error = '') {
     }
 
     // Allow modules to add instances to the new bundle.
-    $modules = module_implements('bundle_create_instances');
+    $modules = module_implements('bundle_instances_info');
     foreach ($modules as $module) {
       $function = $module . '_bundle_instances_info';
       $info = $function('TripalEntity', $bundle);
@@ -483,7 +483,7 @@ function tripal_tripal_cron_notification() {
       return FALSE;
     }
     // Allow modules to add fields to the new bundle.
-    $modules = module_implements('bundle_create_fields');
+    $modules = module_implements('bundle_fields_info');
     foreach ($modules as $module) {
       $function = $module . '_bundle_fields_info';
       $info = $function('TripalEntity', $bundle);
@@ -508,7 +508,7 @@ function tripal_tripal_cron_notification() {
     }
 
     // Allow modules to add instances to the new bundle.
-    $modules = module_implements('bundle_create_instances');
+    $modules = module_implements('bundle_instances_info');
     foreach ($modules as $module) {
       $function = $module . '_bundle_instances_info';
       $info = $function('TripalEntity', $bundle);
@@ -574,7 +574,7 @@ function tripal_refresh_bundle_fields($bundle_name) {
     return FALSE;
   }
   // Allow modules to add fields to the new bundle.
-  $modules = module_implements('bundle_create_fields');
+  $modules = module_implements('bundle_fields_info');
   foreach ($modules as $module) {
     $function = $module . '_bundle_fields_info';
     $info = $function('TripalEntity', $bundle);
@@ -597,7 +597,7 @@ function tripal_refresh_bundle_fields($bundle_name) {
   }
 
   // Allow modules to add instances to the new bundle.
-  $modules = module_implements('bundle_create_instances');
+  $modules = module_implements('bundle_instances_info');
   foreach ($modules as $module) {
     $function = $module . '_bundle_instances_info';
     $info = $function('TripalEntity', $bundle);

+ 3 - 3
tripal/includes/tripal_admin_usage_page.inc

@@ -20,8 +20,7 @@ function tripal_admin_usage_page() {
 }
 
 /**
- * Import the field from the admin notification table on
- * the dashboard.
+ * Import the field from the admin notification table on the dashboard.
  *
  * @param $field_name
  *   The name of the field to be imported.
@@ -44,10 +43,11 @@ function tripal_admin_notification_import_field($field_name_note, $bundle_id, $m
     $function = $module . '_bundle_fields_info';
     $info = $function('TripalEntity', $bundle);
     foreach ($info as $field_name => $details) {
+      $field = field_info_field($field_name);
       if($details['field_name'] == $field_name_note) {
         // Create the field.
         $instance = field_create_field($details);
-        drupal_set_message(t("Created field: %field", array('%field' => $info[ $field_name ]['label'])));
+        drupal_set_message(t("Created field: %field", array('%field' => $field['label'])));
 
         if (!$instance) {
           tripal_set_message(t("Could not create new field: %field.",