/** * Populate the given child form for this object. * @param I2CE_Form $form * @param mixed $forms. A string or an array such, the form names (the child forms to populate) * - array( "demographic", "contact" ) * @param array $orderBy An associative array of form names with an array of either string, field to sort by or an array of the fields * Defaults to empty array * - array( "contact" => "contact_type" ) * */ public function populateChildren($form, $forms, $orderBy = array()) { if (is_scalar($forms)) { $forms = array($forms); } if (!is_array($forms)) { I2CE::raiseError("Invalid arguments passed to populateChildren: "); return; } foreach ($forms as $formName) { if (!array_key_exists($formName, $orderBy)) { $orderBy[$formName] = array(); } $form->populateChild($formName, $orderBy[$formName]); } }