private function cf_dom::p_remove_elements in Common Functionality 7.2
Remove all elements of a given element type.
This preserves child elements. To remove elements entirely, use removeElement() directly.
Parameters
string $type: The new element type to operate on.
DOMNode $parent: The object to operate on.
bool $preserve_children: (optional) If TRUE, children are re-attached to the parent node to preserved their location in the markup. If FALSE, the children remain attached to the removed element.
Return value
bool TRUE on success, FALSE otherwise.
2 calls to cf_dom::p_remove_elements()
- cf_dom::remove_elements in modules/
cf_dom/ classes/ cf_dom.php - Remove all elements of a given element type.
- cf_dom::set_doctype in modules/
cf_dom/ classes/ cf_dom.php - Assigns the document type.
File
- modules/
cf_dom/ classes/ cf_dom.php, line 683 - Provides the cf_dom handling class.
Class
- cf_dom
- The cf_dom class assists in setting up and managing the custom dom object.
Code
private function p_remove_elements($type, $parent, $preserve_children = TRUE) {
$result = TRUE;
$elements = $parent
->getElementsByTagName($type);
foreach ($elements as $element) {
$result = $this
->p_remove_element($element, $preserve_children);
if (!$result) {
break;
}
}
return $result;
}