You are here

function FrxInclude::render_reference in Forena Reports 7.5

1 call to FrxInclude::render_reference()
FrxInclude::render in src/Renderer/FrxInclude.php
Default Render action, which simply does normal forena rendering. You can use renderDomNode at any time to generate the default forena rendering methods.

File

src/Renderer/FrxInclude.php, line 48
FrxInclude Include a reference to another report as an asset. @author davidmetzler

Class

FrxInclude

Namespace

Drupal\forena\Renderer

Code

function render_reference($url, $ext, $attributes) {
  $ext = strtolower($ext);
  $attributes = $this->frxReport
    ->replace($attributes);
  switch ($ext) {
    case 'png':
    case 'gif':
    case 'jpg':
    case 'jpeg':
      $x = new SimpleXMLElement('<img/>');
      $x['src'] = $url;
      if (isset($attributes['height'])) {
        $x['height'] = $attributes['height'];
      }
      if (isset($attributes['width'])) {
        $x['width'] = $attributes['width'];
      }
      break;
    case 'svg':
      $x = new SimpleXMLElement('<embed/>');
      $x['src'] = $url;
      $x['type'] = 'image/svg+xml';
      $x['pluginspage'] = "http://www.adobe.com/svg/viewer/install/";
      if (isset($attributes['height'])) {
        $x['height'] = $attributes['height'];
      }
      if (isset($attributes['width'])) {
        $x['width'] = $attributes['width'];
      }
      break;
    default:
      $x = new SimpleXMLElement('<a>' . $ext . ' document</a>');
      $x['href'] = $url;
  }
  if (isset($attributes['id'])) {
    $x['id'] = $attributes['id'];
  }
  return $x
    ->asXML();
}