You are here

public function FrxEditor::setStyle in Forena Reports 7.3

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

File

./FrxEditor.inc, line 405
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));
  }
}