You are here

function dsDisplay::nestFields in Display Suite 6.3

Helper to nest fieldsets

Parameters

$fields: a flat array of fields to nest

$nested: a nested array of regions to return

1 call to dsDisplay::nestFields()
dsDisplay::prepare in includes/dsDisplay.php
Build field and region information

File

includes/dsDisplay.php, line 622
Class definition for a Display Suite Display object

Class

dsDisplay
The Display Suite Display object

Code

function nestFields(&$fields, &$nested, $current_parent = '#root', $depth = 0) {
  foreach ($fields as $key => $field) {
    if ($field['#parent'] == $current_parent) {
      $children = array();
      ds_nest_fields($fields, $children, $key, $depth + 1);
      $nested[$key]['#weight'] = $field['#weight'];
      $nested[$key]['#depth'] = $depth;
      foreach ($children as $child_key => $child) {
        $nested[$key]['#fields'][$child_key] = $child;
      }
    }
  }
}