You are here

function FrxInclude::render_reference in Forena Reports 8

1 call to FrxInclude::render_reference()
FrxInclude::render in src/FrxPlugin/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/FrxPlugin/Renderer/FrxInclude.php, line 79
FrxInclude Include a reference to another report as an asset. @author davidmetzler

Class

FrxInclude
Include a reprot

Namespace

Drupal\forena\FrxPlugin\Renderer

Code

function render_reference($url, $ext, $attributes, $title) {
  $ext = strtolower($ext);
  if (!$title) {
    $title = "{$ext} document";
  }
  $attributes = $this->teng
    ->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>' . htmlentities($title, ENT_QUOTES) . '</a>');
      $x['href'] = $url;
  }
  if (isset($attributes['id'])) {
    $x['id'] = $attributes['id'];
  }
  if (isset($attributes['class'])) {
    $x['class'] = $attributes['class'];
  }
  return $x
    ->asXML();
}