You are here

public function ReportEditor::setMenu in Forena Reports 7.5

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

File

src/Editor/ReportEditor.php, line 602
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

public function setMenu($menu_data) {
  $dom = $this->dom;
  $this
    ->verifyHeaderElements(array(
    'menu',
  ));
  $options = $dom
    ->getElementsByTagNameNS($this->xmlns, 'menu')
    ->item(0);
  foreach ($menu_data as $key => $value) {
    if ($value) {
      $options
        ->setAttribute($key, $value);
    }
    else {
      if ($options
        ->hasAttribute($key)) {
        $options
          ->removeAttribute($key);
      }
    }
  }
}