You are here

public function Report::render in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 src/Report.php \Drupal\forena\Report::render()

Render the report

File

src/Report.php, line 390
Basic report provider. Controls the rendering of the report.

Class

Report

Namespace

Drupal\forena

Code

public function render($format, $render_form = TRUE, $cache_data = array()) {

  /** @var \DOMDOcument $dom */
  $dom = $this->dom;

  // Trap error condition
  if (!$dom) {
    return;
  }
  $body = $dom
    ->getElementsByTagName('body')
    ->item(0);
  $this
    ->preloadData();

  // Render the rport.

  /** @var \Drupal\forena\FrxPlugin\Renderer\RendererBase $c */
  $c = $this
    ->getRenderer();
  $c
    ->initReportNode($body);
  if (!$this->missing_parms) {
    $c
      ->renderChildren($body, $this->html);
  }

  // Determine the correct filter.
  $filter = $this->input_format;
  $skinfo = $this
    ->getDataContext('skin');
  if (isset($skinfo['input_format'])) {
    $filter = $skinfo['input_format'];
  }
  if (isset($this->options['input_format'])) {
    $filter = $this->options['input_format'];
  }
  if ($filter && $filter != 'none') {
    $this->html = check_markup($this->html, $filter);
  }

  // Default in dynamic title from head.
  if ($this->frx_title) {
    $title = check_plain($this->replacer
      ->replace($this->frx_title));
    if ($title) {
      $this->title = $title;
    }
  }

  // Process the commands after the replacement
  if ($this->commands) {
    foreach ($this->commands as $event => $commands) {
      foreach ($commands as $command) {
        $this
          ->getDocument()
          ->addAjaxCommand($command, $event);
      }
    }
  }
}