/** * Removes the element from this container * * If the reference object is not given, the element will be appended. * * @param HTML_QuickForm2_Node Element to remove * @return HTML_QuickForm2_Node Removed object */ public function removeChild(HTML_QuickForm2_Node $element) { if ($element->getContainer() !== $this) { throw new HTML_QuickForm2_NotFoundException("Element with name '" . $element->getName() . "' was not found"); } foreach ($this as $key => $child) { if ($child === $element) { unset($this->elements[$key]); $element->setContainer(null); break; } } return $element; }