Fix for display suite field group

  1. /**
  2.  * Theme function to render the field content.
  3.  *
  4.  * @param string $content The content to render.
  5.  * @param array $field Collection of field properties.
  6.  */
  7. function hillandknowlton_ds_field($content, $field) {
  8.        
  9.         //set variable
  10.         $no_group = false;
  11.        
  12.         if($field['key'] == 'group_testimonee'){
  13.                
  14.         //get the current node in the mix
  15.         $node = node_load(arg(1));
  16.         //dsm($node);
  17.     //dsm($field);
  18.  
  19.     //shorten testimonee variables
  20.     $t1 = $node->field_testimonee_text[0]['value'];
  21.     $t2 = $node->field_testimonee_name[0]['value'];
  22.     $t3 = $node->field_testimonee_function[0]['value'];
  23.    
  24.     //if one of these 3 fields is not filled out, don't display this field group at all.
  25.     if(($t1 == '') OR ($t2 == '') OR ($t3 == '')) $no_group = true;
  26.         }
  27.  
  28.        
  29.   $output = '';
  30.  
  31.   if (!empty($content)) {
  32.     if ($field['type'] == 'ds') {
  33.  
  34.       $output .= '<div class="field '. $field['class'] .'">';
  35.       // Above label.
  36.       if ($field['labelformat'] == 'above') {
  37.         $output .= '<div class="field-label">'. $field['title'] .': </div>';
  38.       }
  39.       // Inline label
  40.       if ($field['labelformat'] == 'inline') {
  41.         $output .= '<div class="field-label-inline-first">'. $field['title'] .': </div>';
  42.       }
  43.       $output .= $content;
  44.       $output .= '</div>';
  45.     }
  46.     else {
  47.       $output = $content;
  48.     }
  49.   }
  50.  
  51.   if($no_group == true) $output = '';
  52.   return $output;
  53. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.