You are here

public function FrxEditor::setStyle in Forena Reports 7.4

Same name and namespace in other branches
  1. 7.3 FrxEditor.inc \FrxEditor::setStyle()

File

./FrxEditor.inc, line 587
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 setStyle($css) {
  $dom = $this->dom;

  //$this->verifyHeaderElements(array('menu'));
  $head = $dom
    ->getElementsByTagName('head')
    ->item(0);
  $nodes = $dom
    ->getElementsByTagName('style');
  $style = $dom
    ->createElement('style');
  $style
    ->appendChild(new DOMText($css));
  if ($nodes->length == 0) {
    $head
      ->appendChild($style);
  }
  else {
    $head
      ->replaceChild($style, $nodes
      ->item(0));
  }
}