Browse Source

Merge pull request #472 from tripal/fix-tv3-minor_fixes

Fixed a major bug with web service field alter but minor code change
Lacey-Anne Sanderson 6 năm trước cách đây
mục cha
commit
f07412362a

+ 3 - 3
tripal/includes/TripalImporter.inc

@@ -302,7 +302,7 @@ class TripalImporter {
           foreach ($fids as $fid) {
             $file = file_load($fid);
             $arguments['files'][] = array(
-              'file_path' => base_path() . drupal_realpath($file->uri),
+              'file_path' => drupal_realpath($file->uri),
               'fid' => $fid
             );
             $has_file++;
@@ -313,14 +313,14 @@ class TripalImporter {
           $fid = $file_details['fid'];
           $file = file_load($fid);
           $arguments['files'][] = array(
-            'file_path' => base_path() . drupal_realpath($file->uri),
+            'file_path' => drupal_realpath($file->uri),
             'fid' => $fid
           );
           $has_file++;
 
           // For backwards compatibility add the old 'file' element.
           $arguments['file'] = array(
-            'file_path' => base_path() . drupal_realpath($file->uri),
+            'file_path' => drupal_realpath($file->uri),
             'fid' => $fid
           );
         }

+ 1 - 1
tripal_chado/tripal_chado.module

@@ -1054,7 +1054,7 @@ function tripal_chado_form_field_ui_field_edit_form_alter(&$form, &$form_state,
 
     // If this is a Chado field we need to preserve the Chado elements of the
     // settings or they will be lost if a user edits the field settings.
-    if (array_key_Exists('chado_table', $form['#instance']['settings'])) {
+    if (array_key_exists('chado_table', $form['#instance']['settings'])) {
       $form['instance']['settings']['base_table'] = array(
         '#type' => 'value',
         '#value' => $form['#instance']['settings']['base_table'],

+ 5 - 1
tripal_ws/tripal_ws.module

@@ -438,8 +438,12 @@ function tripal_ws_load_remote_entity($site_id, $api_version, $ctype, $id) {
 }
 
 function tripal_ws_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
+  // Don't let the user change the cardinality of web services fields
   if ($form['#instance']['entity_type'] == 'TripalEntity') {
+    if ($form['#field']['storage']['type'] == 'field_tripal_ws_storage') {
       $form['field']['cardinality']['#access'] = FALSE;
+      $form['instance']['required']['#access'] = FALSE;
+    }
   }
 }
 
@@ -472,4 +476,4 @@ function tripal_ws_entity_info_alter(&$entity_info) {
       'custom settings' => FALSE,
     ),
   );
-}
+}