/** * Returns the child controls of the current QForm or a QControl object * * @param QForm|QControl|QFormBase $objParentObject The object whose child controls are to be searched for * * @throws QCallerException * @return QControl[] */ public function GetChildControls($objParentObject) { $objControlArrayToReturn = array(); if ($objParentObject instanceof QForm) { // They want all the ChildControls for this Form // Basically, return all objControlArray QControls where the Qcontrol's parent is NULL foreach ($this->objControlArray as $objChildControl) { if (!$objChildControl->ParentControl) { array_push($objControlArrayToReturn, $objChildControl); } } return $objControlArrayToReturn; } else { if ($objParentObject instanceof QControl) { return $objParentObject->GetChildControls(); // THey want all the ChildControls for a specific Control // Basically, return all objControlArray QControls where the Qcontrol's parent is the passed in parentobject /* $strControlId = $objParentObject->ControlId; foreach ($this->objControlArray as $objChildControl) { $objParentControl = $objChildControl->ParentControl; if (($objParentControl) && ($objParentControl->ControlId == $strControlId)) { array_push($objControlArrayToReturn, $objChildControl); } }*/ } else { throw new QCallerException('ParentObject must be either a QForm or QControl object'); } } }