You are here

public function FrxEditor::deleteNode in Forena Reports 7.4

Delete a node based on id

Parameters

unknown_type $id:

Return value

unknown_type

File

./FrxEditor.inc, line 737
FrxEditor.inc Wrapper XML class for working with DOM object. It provides helper Enter description here ... @author metzlerd

Class

FrxEditor
@file FrxEditor.inc Wrapper XML class for working with DOM object. It provides helper Enter description here ... @author metzlerd

Code

public function deleteNode($id) {
  $path = 'body//*[@id="' . $id . '"]';
  $dom = $this->dom;
  $nodes = $this->simplexml
    ->xpath($path);
  if ($nodes) {
    $node = $nodes[0];
    $dom = dom_import_simplexml($node);
    $dom->parentNode
      ->removeChild($dom);
  }
  return $this;
}