You are here

function flexiform_multistep_field_group_descendants in Flexiform 7

Get all descendants of a field group.

Parameters

array $groups: An array of group objects keyed by machine name, e.g. $form['#groups'].

$group: Either the machine name or a group object we want the descendants of.

Return value

array An array of element names that are descendants of $group.

1 call to flexiform_multistep_field_group_descendants()
flexiform_multistep_step_form in flexiform_multistep/flexiform_multistep.pages.inc
Form constructor for a specific step of a multistep flexiform.

File

flexiform_multistep/flexiform_multistep.pages.inc, line 411
Page callbacks for Flexiform Multistep.

Code

function flexiform_multistep_field_group_descendants($groups, $group) {
  if (!is_object($group)) {
    $group = $groups[$group];
  }

  // Get the children from this group.
  $children = $group->children;

  // See if there are any groups as children and, if so, recurse.
  foreach ($group->children as $child) {
    if (isset($groups[$child])) {
      $children = array_merge($children, flexiform_multistep_field_group_descendants($groups, $child));
    }
  }
  return $children;
}