public function Report::deleteNode in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/Report.php \Drupal\forena\Report::deleteNode()
Delete a node based on id
Parameters
string $id:
File
- src/
Report.php, line 456 - Basic report provider. Controls the rendering of the report.
Class
Namespace
Drupal\forenaCode
public function deleteNode($id) {
$path = 'body//*[@id="' . $id . '"]';
$nodes = $this->rpt_xml
->xpath($path);
if ($nodes) {
/** @var \SimpleXMLElement $node */
$node = $nodes[0];
$dom = dom_import_simplexml($node);
$dom->parentNode
->removeChild($dom);
}
}