You are here

public function ReportEditor::setCache in Forena Reports 8

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

File

src/Editor/ReportEditor.php, line 648
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 setCache($data) {
  $dom = $this->dom;
  $this
    ->verifyHeaderElements(array(
    'cache',
  ));

  /** @var \DOMElement $options */
  $options = $dom
    ->getElementsByTagNameNS($this->xmlns, 'cache')
    ->item(0);
  foreach ($data as $key => $value) {
    if ($value) {
      $options
        ->setAttribute($key, $value);
    }
    else {
      if ($options
        ->hasAttribute($key)) {
        $options
          ->removeAttribute($key);
      }
    }
  }
}