You are here

private function ReportEditor::cleanup_ids in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 src/Editor/ReportEditor.php \Drupal\forena\Editor\ReportEditor::cleanup_ids()

Removes the attributes associated with forena-# that are added by forena. There is no real reason to persist them as they can be added on later and they are only created for wysiwyg compatibility.

1 call to ReportEditor::cleanup_ids()
ReportEditor::save in src/Editor/ReportEditor.php
Save report

File

src/Editor/ReportEditor.php, line 724
ReportEditor.inc Wrapper XML class for working with DOM object. It provides helper Enter description here ... @author metzlerd

Class

ReportEditor

Namespace

Drupal\forena\Editor

Code

private function cleanup_ids() {
  if ($this->simplexml) {
    $this->simplexml
      ->registerXPathNamespace('frx', FRX_NS);
    $frx_attributes = array();
    $frx_nodes = $this->simplexml
      ->xpath('body//*[@frx:*]');
    if ($frx_nodes) {
      foreach ($frx_nodes as $node) {
        $attr_nodes = $node
          ->attributes(FRX_NS);
        if ($attr_nodes) {
          if ((string) $node['id'] && strpos($node['id'], 'forena-') === 0) {
            unset($node['id']);
          }
        }
      }
    }
  }
}