/**
* Method to remove a group from the form definition.
*
* @param string $group The dot-separated form group path for the group to remove.
*
* @return boolean True on success.
*
* @since 1.7.0
* @throws \UnexpectedValueException
*/
public function removeGroup($group)
{
// Make sure there is a valid Form XML document.
if (!$this->xml instanceof \SimpleXMLElement) {
throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__));
}
// Get the fields elements for a given group.
$elements =& $this->findGroup($group);
foreach ($elements as &$element) {
$dom = dom_import_simplexml($element);
$dom->parentNode->removeChild($dom);
}
return true;
}