Index: field_group.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/field_group/field_group.module,v
retrieving revision 1.10.2.61
diff -u -r1.10.2.61 field_group.module
--- field_group.module	6 Jan 2011 10:11:48 -0000	1.10.2.61
+++ field_group.module	7 Jan 2011 00:17:55 -0000
@@ -445,13 +445,19 @@
     'data' => array('field_group' => array($group->format_type => TRUE)),
     'type' => 'setting',
   );
+  
+  //If field is required, add asterik
+  $required = '';
+  if($group->required) {
+    $required = '<span title="This group has required fields" class="form-required">*</span>';
+  }
 
   switch ($group->format_type) {
     // Fieldset.
     case 'fieldset':
       $element += array(
         '#type' => 'fieldset',
-        '#title' => check_plain(t($group->label)),
+        '#title' => check_plain(t($group->label)).$required,
         '#weight' => $group->weight,
         '#collapsible' => $collapsible,
         '#collapsed' => $collapsed,
@@ -502,7 +508,7 @@
         '#type' => 'markup',
         '#prefix' => '
         <h3 class="field-group-format-toggler ' . $group->format_type . ($collapsed ? '' : ' field-group-accordion-active') . '">' . check_plain(t($group->label)) . '</h3>
-        <div class="field-group-format-wrapper">',
+        '.$required.'<div class="field-group-format-wrapper">',
         '#suffix' => '</div>',
         '#weight' => $group->weight,
         //'#attributes' => array('class' => array($group->format_type)),
@@ -527,7 +533,7 @@
     case 'htab':
       $element += array(
         '#type' => 'fieldset',
-        '#title' => check_plain(t($group->label)),
+        '#title' => check_plain(t($group->label)).$required,
         '#weight' => $group->weight,
         '#collapsible' => $collapsible,
         '#collapsed' => $collapsed,
@@ -557,7 +563,7 @@
       if (isset($form['#view_mode'])) {
         $element += array(
           '#type' => 'fieldset',
-          '#title' => check_plain(t($group->label)),
+          '#title' => check_plain(t($group->label)).$required,
           '#weight' => $group->weight,
           '#collapsible' => $collapsible,
           '#collapsed' => $collapsed,
@@ -570,7 +576,7 @@
       else {
         $form['additional_settings'][$group->group_name] = array(
           '#type' => 'fieldset',
-          '#title' => check_plain(t($group->label)),
+          '#title' => check_plain(t($group->label)).$required,
           '#weight' => $group->weight,
           '#collapsible' => $collapsible,
           '#collapsed' => $collapsed,
@@ -937,13 +943,34 @@
 
   $element['#groups'] = field_group_info_groups($entity_type, $bundle, $view_mode);
 
-  // Create a lookup array.
+  // Create a lookup array and check required fields
   $group_children = array();
-  foreach ($element['#groups'] as $group_name => $group) {
+  $rgroups = $element['#groups'];
+  //Reverse order for so deepest first
+  arsort($rgroups);
+
+  foreach ($rgroups as $group_name => $group) {
+    $group->required = isset($group->required)? $group->required : FALSE;
     foreach ($group->children as $child) {
       $group_children[$child] = $group_name;
+      //Check if this is a field and group isn't already true, if so check if required
+      if(isset($element[$child]) && !$group->required) {
+        if(isset($element[$child]['#required'])) {
+          $group->required = ($element[$child]['#required']) ? TRUE : $group->required;
+        }
+      }
+    }
+    // Set results after iterating through array.
+    $element['#groups'][$group_name]->required = $group->required;
+    // If array has parents set TRUE
+    if(isset($element['#groups'][$element['#groups'][$group_name]->parent_name])) {
+      if($group->required) {
+        $rgroups[$element['#groups'][$group_name]->parent_name]->required = $group->required;
+      }
     }
   }
+  //reverse the order back
+  arsort($group_children);
   $element['#group_children'] = $group_children;
 
   // Add a pre render or process callback.

