Browse Source

Fixed bug with checkbox fields not showing up in widgets

Stephen Ficklin 7 years ago
parent
commit
880aaf3d7a

+ 1 - 1
tripal/includes/tripal.fields.inc

@@ -338,7 +338,7 @@ function tripal_form_field_ui_field_overview_form_submit($form, &$form_state) {
       $type = $form_values['_add_new_field']['type'];
       if (tripal_load_include_field_class($type)) {
         $module = $type::$module;
-        dpm($module);
+
         $function = $module . '_bundle_create_user_field';
         $bundle = tripal_load_bundle_entity(array('name' => $form['#bundle']));
         $field_name = $form_values['_add_new_field']['field_name'];

+ 7 - 2
tripal/tripal.module

@@ -750,13 +750,18 @@ function tripal_form_alter(&$form, $form_state, $form_id) {
   }
 
   // Remove fields that have no form. It's just a bit too confusing to have
-  // widgets appear in the form but without and form elements inside them.
+  // widgets appear in the form but without any form elements inside them.
   if ($form_id == 'tripal_entity_form') {
     $children = element_children($form);
     foreach ($children as $child) {
-      // count the number of form elements
+      // Count the number of form elements.
       if (array_key_exists('und', $form[$child])) {
         $total_widgets = 0;
+        // Some fields with cardinality of one that aren't TripalFields
+        // may not have an array, so we need to catch those.
+        if (array_key_exists('#type', $form[$child]['und'])) {
+          $total_widgets++;
+        }
         foreach ($form[$child]['und'] as $delta => $element) {
           if (is_numeric($delta)) {
             $total_widgets += count(element_children($element));

+ 1 - 2
tripal_ws/includes/TripalWebService/TripalEntityService_v0_1.inc → tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc

@@ -1,6 +1,6 @@
 <?php
 
-class TripalEntityService_v0_1 extends TripalWebService {
+class TripalContentService_v0_1 extends TripalWebService {
 
   /**
    * The human-readable label for this web service.
@@ -242,7 +242,6 @@ class TripalEntityService_v0_1 extends TripalWebService {
       if ($instance['display']['default']['type'] == 'hidden') {
         continue;
       }
-
       // Get the information about this field.
       $field = field_info_field($field_name);