You are here

public function FrxXML::render in Forena Reports 8

Default Render action, which simply does normal forena rendering. You can use renderDomNode at any time to generate the default forena rendering methods.

Return value

string text from the renderer.

Overrides RendererBase::render

File

src/FrxPlugin/Renderer/FrxXML.php, line 19
FrxXML Just render the XML source data. Look at the FrxRender class to see a full list of properties that can be used here.

Class

FrxXML
XML Data Renderer

Namespace

Drupal\forena\FrxPlugin\Renderer

Code

public function render() {
  $output = '';
  $node = $this->reportNode;
  $options = $this
    ->mergedAttributes();
  if (isset($options['context'])) {
    $xml = $this
      ->getDataContext($options['context']);
  }
  else {
    $xml = $this
      ->currentDataContext();
  }
  if (is_array($xml)) {
    $xml = DataContext::arrayToXml($xml);
  }
  if ($xml && is_callable(array(
    $xml,
    'asXML',
  ))) {
    $dom = dom_import_simplexml($xml);
    $dom->ownerDocument->formatOutput = TRUE;
    $dom->ownerDocument->preserveWhiteSpace = TRUE;
    $output = $dom->ownerDocument
      ->saveXML($dom->ownerDocument->documentElement);
  }
  if ($this->report->format != 'xml') {
    $output = '<pre>' . htmlspecialchars($output) . '</pre>';
  }
  return $output;
}