Browse Source

fixing disabled fields on initial content type creation and the publication menu and summary table

Shawna 7 years ago
parent
commit
ba8a79f6b8
2 changed files with 17 additions and 11 deletions
  1. 16 9
      tripal_ds/includes/tripal_ds.ds.inc
  2. 1 2
      tripal_ds/includes/tripal_ds.field_group.inc

+ 16 - 9
tripal_ds/includes/tripal_ds.ds.inc

@@ -46,6 +46,9 @@ function _ds_layout_settings_info($bundle_name, $instances) {
   $fields_with_regions = array();
   $i = 0;
   $all_fields = array();
+  watchdog('debug', '<pre>$bundle_name: '. print_r($bundle_name, TRUE) .'</pre>');
+
+  watchdog('debug', '<pre>$instances: '. print_r($instances, TRUE) .'</pre>');
 
   try {
     // Get the bundle and term objects.
@@ -142,14 +145,17 @@ function _ds_layout_settings_info($bundle_name, $instances) {
     // order to display fields in label alpha order.
     $right_fields = array();
     $all_field_groups = field_group_info_groups('TripalEntity', $bundle_name);
-    if (is_array($all_field_groups)) {
-      if (!isset($all_field_groups['default'])) {
-        $all_field_groups['default'] = array();
-      }
-      foreach ($all_field_groups['default'] as $key => $field_name) {
-        $right_fields[$key] = $field_name;
+
+    if(!empty($all_field_groups)){
+      if (is_array($all_field_groups)) {
+        if (!isset($all_field_groups['default'])) {
+          $all_field_groups['default'] = array();
+        }
+        foreach ($all_field_groups['default'] as $key => $field_name) {
+          $right_fields[$key] = $field_name;
+        }
+        usort($right_fields, tripal_ds_sort_object('label'));
       }
-      usort($right_fields, tripal_ds_sort_object('label'));
     }
     elseif(empty($all_field_groups)) {
       //Add the original instances that were passed and the field_groups that
@@ -250,9 +256,10 @@ function _ds_layout_settings_info($bundle_name, $instances) {
       'layout_disable_css' => 0,
     );
     $record->settings = $settings;
+
     drupal_write_record('ds_layout_settings', $record);
     // Clear the Drupal cache.
-    cache_clear_all();
+    drupal_flush_all_caches();
   }
   catch (Exception $e) {
     watchdog_exception('tripal_ds', $e);
@@ -380,7 +387,7 @@ function _ds_layout_pub_settings_info($bundle_name, $instances) {
     $record->settings = $settings;
     drupal_write_record('ds_layout_settings', $record);
     // Clear the Drpual chace
-    cache_clear_all();
+    drupal_flush_all_caches();
   }
   catch (Exception $e) {
     watchdog_exception('tripal_ds', $e);

+ 1 - 2
tripal_ds/includes/tripal_ds.field_group.inc

@@ -261,7 +261,6 @@ function _additional_fields_field_group_info($bundle_name, $field_label, $group_
       ),
     ),
   );
-  watchdog('debug', '<pre>$field_group_fieldset: '. print_r($field_group_fieldset, TRUE) .'</pre>');
   drupal_write_record('field_group', $field_group_fieldset);
 }
 
@@ -303,7 +302,7 @@ function _publication_prop_field_group_info($bundle_name, $fields){
   );
   drupal_write_record('field_group', $field_group_tripalpane);
   //Write to the tripal_ds table to record the new tripal pane.
-  tripal_ds_bundle_menu_item($bundle_name, 'Properties', 'group_prop_tripalpane', 'TripalEntity');
+  tripal_ds_bundle_menu_item($bundle_name, 'Summary', 'group_summary_tripalpane', 'TripalEntity');
 
   //Table of fields.
   $field_group = new stdClass();