ソースを参照

Merge branch '7.x-3.x-dashboard' into 7.x-3.x

Stephen Ficklin 7 年 前
コミット
5781e2c98c

+ 22 - 16
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);
@@ -278,7 +285,6 @@ function _ds_layout_pub_settings_info($bundle_name, $instances) {
   $all_fields = array();
   $instances_for_field_groups = array();
   $disabled_instances = array();
-  watchdog('debug', '<pre>$instances: '. print_r($instances, TRUE) .'</pre>');
   try {
     // Add Abstract, Citation, DB Cross Reference, Properties.
     $all_fields['tpub__abstract']= 'right';
@@ -293,15 +299,16 @@ function _ds_layout_pub_settings_info($bundle_name, $instances) {
     foreach ($instances as $key => $instance) {
       $instance_name = $instance['field_name'];
 
-      if($instance_name == 'tpub__abstract' || $instance_name == 'tpub__citation'
-        || $instance_name == 'sbo__database_cross_reference'
+      if($instance_name == 'sbo__database_cross_reference'
         || $instance_name == 'sio__references'){
         array_push($instances_for_field_groups, $instance);
         // Update the display settings so that the title is hidden.
         $instance['display']['default']['label'] = 'hidden';
         field_update_instance($instance);
       }
-      elseif($instance_name == 'schema__additional_type' || $instance_name == 'tpub__doi' || $instance_name == 'tpub__publication_date') {
+      elseif($instance_name == 'schema__additional_type' || $instance_name == 'tpub__doi'
+        || $instance_name == 'tpub__publication_date' || 'tpub__abstract' ||
+        $instance_name == 'tpub__citation') {
         array_push($properties, $instance_name);
       }
       else {
@@ -335,9 +342,9 @@ function _ds_layout_pub_settings_info($bundle_name, $instances) {
     //Properties table fields.
     if(!empty($properties)){
       _publication_prop_field_group_info($bundle_name, $properties);
-      array_unshift($properties, 'group_prop_tripalpane', 'group_prop_table');
+      array_unshift($properties, 'group_summary_tripalpane', 'group_summary_table');
       $region_right = array_merge($region_right, $properties);
-      $all_fields+= [ 'group_prop_tripalpane' => 'right', 'group_prop_table' => 'right' ];
+      $all_fields+= [ 'group_summary_tripalpane' => 'right', 'group_summary_table' => 'right' ];
     }
     if(!empty($all_fields)){
       foreach ($disabled_instances as $disabled_field) {
@@ -380,8 +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();
-    watchdog('debug', '<pre>$record: '. print_r($record, TRUE) .'</pre>');
+    drupal_flush_all_caches();
   }
   catch (Exception $e) {
     watchdog_exception('tripal_ds', $e);

+ 13 - 12
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);
 }
 
@@ -278,17 +277,17 @@ function _publication_prop_field_group_info($bundle_name, $fields){
   $field_group_tripalpane = new stdClass();
   $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
   $field_group_tripalpane->api_version = 1;
-  $field_group_tripalpane->identifier = 'group_prop_tripalpane|TripalEntity|'.$bundle_name.'|default';
-  $field_group_tripalpane->group_name = 'group_prop_tripalpane';
+  $field_group_tripalpane->identifier = 'group_summary_tripalpane|TripalEntity|'.$bundle_name.'|default';
+  $field_group_tripalpane->group_name = 'group_summary_tripalpane';
   $field_group_tripalpane->entity_type = 'TripalEntity';
   $field_group_tripalpane->bundle = $bundle_name;
   $field_group_tripalpane->mode = 'default';
   $field_group_tripalpane->parent_name = '';
   $field_group_tripalpane->data = array(
-    'label' => 'Properties',
+    'label' => 'Summary',
     'weight' => '1',
     'children' => array(
-      0 => 'group_prop_table',
+      0 => 'group_summary_table',
     ),
     'format_type' => 'tripalpane',
     'format_settings' => array(
@@ -297,35 +296,37 @@ function _publication_prop_field_group_info($bundle_name, $fields){
         'id' => 'tripal_ds-fieldset-group_prop_tripalpane',
         'classes' => 'group-prop-tripalpane field-group-tripalpane',
         'description' => '',
-        'hide' => 1,
+        'hide' => 0,
       ),
     ),
   );
   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();
   $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
   $field_group->api_version = 1;
-  $field_group->identifier = 'group_prop_table|TripalEntity|'.$bundle_name.'|default';
-  $field_group->group_name = 'group_prop_table';
+  $field_group->identifier = 'group_summary_table|TripalEntity|'.$bundle_name.'|default';
+  $field_group->group_name = 'group_summary_table';
   $field_group->entity_type = 'TripalEntity';
   $field_group->bundle = $bundle_name;
   $field_group->mode = 'default';
-  $field_group->parent_name = 'group_prop_tripalpane';
+  $field_group->parent_name = 'group_summary_tripalpane';
   $field_group->data = array(
-    'label' => 'Properties Table',
+    'label' => 'Summary Table',
     'weight' => '1',
     'children' =>  array(
       0 => 'tpub__doi',
       1 => 'tpub__publication_date',
       2 => 'schema__additional_type',
+      3 => 'tpub__abstract',
+      4 => 'tpub__citation'
     ),
     'format_type' => 'table',
     'format_settings' => array(
-      'label' => 'Properties Table',
+      'label' => 'Summary Table',
       'instance_settings' => array(
         'label_visibility' => '1',
         'desc' => '',