You are here

public function ReportEditor::setDocgen in Forena Reports 7.5

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

Set document generation types that apply to this report. Enter description here ...

Parameters

unknown_type $docgenElements:

1 call to ReportEditor::setDocgen()
ReportEditor::ensureDocGen in src/Editor/ReportEditor.php
Makes sure specific document types are asserted.

File

src/Editor/ReportEditor.php, line 439
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 setDocgen($doctypes) {
  $docgenElements = array();
  if ($selected = array_filter($doctypes)) {
    if ($selected) {
      foreach ($selected as $key => $value) {
        if ($value) {
          $docgenElements[] = array(
            'type' => $key,
          );
        }
      }
    }
  }
  $dom = $this->dom;
  $newDocs = $dom
    ->createElementNS($this->xmlns, 'docgen');
  $this
    ->verifyHeaderElements(array(
    'docgen',
  ));
  $dnode = $dom
    ->getElementsByTagNameNS($this->xmlns, 'docgen')
    ->item(0);
  $p = $dnode->parentNode;
  $p
    ->replaceChild($newDocs, $dnode);
  $this
    ->setFrxHeader('docgen', 'doc', $docgenElements, array(
    'type',
  ), NULL, 'type');
}