Browse Source

Just added a few comments and minor fixes

Stephen Ficklin 9 years ago
parent
commit
5c0a349bb3

+ 3 - 1
tripal_entities/includes/TripalEntityController.inc

@@ -54,12 +54,14 @@ class TripalEntityController extends EntityAPIController {
    *   An array of entity IDs or a single numeric ID.
    */
   public function deleteMultiple($entities) {
+    dpm($entities);
     $ids = array();
     if (!empty($entities)) {
       $transaction = db_transaction();
       try {
-        foreach ($entities as $entity) {
+        foreach ($entities as $entity_id) {
           // Invoke hook_entity_delete().
+          $entity = entity_load($entity_id);
           module_invoke_all('entity_delete', $entity, $entity->type);
           field_attach_delete($entity->type, $entity);
           $ids[] = $entity->id;

+ 1 - 1
tripal_entities/includes/tripal_entities.admin.inc

@@ -520,7 +520,7 @@ function tripal_entities_add_bundle_fields($entity_type_name, $bundle_name, $cvt
           'field_name' => $field_name,
           'type' => $field_type,
           'cardinality' => 1,
-          'locked' => TRUE,
+          'locked' => FALSE,
           'storage' => array(
             'type' => 'field_chado_storage'
           ),

+ 2 - 2
tripal_entities/includes/tripal_entities.field_storage.inc

@@ -18,7 +18,7 @@ function tripal_entities_field_storage_info() {
 function tripal_entities_field_storage_write($entity_type, $entity, $op, $fields) {
 
   // Conver the fields into a key/value list of fields and their values.
-  $field_vals = tripal_entities_field_storage_reformat_fields($fields, $entity_type, $entity);
+  $field_vals = tripal_entities_field_storage_unnest_fields($fields, $entity_type, $entity);
   $transaction = db_transaction();
   try {
     switch ($op) {
@@ -254,7 +254,7 @@ function tripal_entities_field_storage_load($entity_type, $entities, $age, $fiel
  *
  * @param $fields
  */
-function tripal_entities_field_storage_reformat_fields($fields, $entity_type, $entity) {
+function tripal_entities_field_storage_unnest_fields($fields, $entity_type, $entity) {
   $new_fields = array();
   foreach ($fields as $field_id => $ids) {
     $field = field_info_field_by_id($field_id);

+ 6 - 2
tripal_entities/includes/tripal_entities.fields.inc

@@ -18,7 +18,7 @@ function tripal_entities_field_info() {
       ),
     ),
     'dbxref_id' => array(
-      'label' => t('Primary Cross-reference'),
+      'label' => t('Cross-reference'),
       'description' => t('This record can be cross-referenced with a record in another online database. This field is intended for the most prominent reference.  At a minimum, the database and accession must be provided.'),
       'default_widget' => 'tripal_entities_primary_dbxref_widget',
       'default_formatter' => 'tripal_entities_primary_dbxref_formatter',
@@ -82,6 +82,8 @@ function tripal_entities_field_formatter_view($entity_type, $entity, $field, $in
     case 'tripal_entities_organism_formatter':
       foreach ($items as $delta => $item) {
         $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $item['value']));
+        // TODO: add hook here to allow other modules to change this display
+        // if they want.
         $element[$delta] = array(
           // We create a render array to produce the desired markup,
           // "<p>Genus Species</p>".
@@ -101,6 +103,8 @@ function tripal_entities_field_formatter_view($entity_type, $entity, $field, $in
             $accession = l($accession, $dbxref->db_id->urlprefix . '/' . $dbxref->accession);
           }
         }
+        // TODO: add hook here to allow other modules to change this display
+        // if they want.
         $element[$delta] = array(
           // We create a render array to produce the desired markup,
           '#type' => 'markup',
@@ -159,7 +163,7 @@ function tripal_entities_field_widget_form(&$form, &$form_state, $field,
         '#element_validate' => array('tripal_entities_primary_dbxref_widget_validate'),
         '#type' => 'fieldset',
         '#title' => $element['#title'],
-        '#description' => 'Hi', // $element['#description'],
+        '#description' =>  $element['#description'],
         '#weight' => isset($element['#weight']) ? $element['#weight'] : 0,
         '#delta' => $delta,
         '#theme' => 'tripal_entities_primary_dbxref_widget',