You are here

function fieldgroup_order_fields_groups in Content Construction Kit (CCK) 6.3

This is function fieldgroup_order_fields_and_groups

Parameters

array $group_rows An empty array that we will fill.:

array $groups All of the info we need about all of the groups for the content type we're working on.:

array $field_check_off This contains the fields. We will unset them as we process them.:

2 calls to fieldgroup_order_fields_groups()
fieldgroup_form_alter in modules/fieldgroup/fieldgroup.module
Implementation of hook_form_alter()
fieldgroup_nodeapi in modules/fieldgroup/fieldgroup.module
Implementation of hook_nodeapi().

File

modules/fieldgroup/fieldgroup.module, line 428
Create field groups for CCK fields.

Code

function fieldgroup_order_fields_groups(&$group_rows, &$groups, &$field_check_off) {
  $max_depth = 0;
  foreach ($group_rows as $name) {
    $depth = $groups[$name]['depth'];
    if ($depth > $max_depth) {
      $max_depth = $depth;
    }
    $parent = $groups[$name]['parent'];

    //run through the fields and come up with new weights for display purposes
    if (isset($groups[$name]['fields'])) {
      foreach ($groups[$name]['fields'] as $name2 => $elements) {
        $depth2 = $groups[$name]['depth'] + 1;
        $groups[$name]['fields'][$name2]['depth'] = $depth2;
        if (in_array($name2, $field_check_off)) {
          $index = array_search($name2, $field_check_off);
          unset($field_check_off[$index]);
        }
      }
    }
  }
  return $max_depth;
}