You are here

public function ReportEditor::documentLinks in Forena Reports 8

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

File

src/Editor/ReportEditor.php, line 1169
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 documentLinks() {
  $doctypes = array_keys($this
    ->documentManager()
    ->getDocTypes());
  $links = array();
  $r = $this->frxReport;
  $formats = $r->formats ? $r->formats : array_filter(\Drupal::config('forena.settings')
    ->get('doc_defaults'));
  $parms = $this
    ->getDataContext('parm');
  foreach ($doctypes as $ext) {
    if (array_search($ext, $formats) !== FALSE) {
      $links[] = array(
        'title' => strtoupper($ext),
        'href' => $this->report_link . ".{$ext}",
        'query' => $parms,
      );
    }
  }
  if ($links) {
    return array(
      '#theme' => 'links',
      '#links' => $links,
      '#attributes' => array(
        'class' => array(
          'forena-doclinks',
        ),
      ),
    );
  }
  return '';
}