You are here

public function RendererBase::replaceTokens in Forena Reports 8

A helper function to allow replacement of tokens from inside a renderer wihout needing to understand the object

Parameters

string $text: Text containing tokens to replace.

bool $raw_mode: TRUE implies that token data should not formatted for human consumption.

Return value

string Replaced text.

1 call to RendererBase::replaceTokens()
FrxSVGGraph::renderGraph in src/FrxPlugin/Renderer/FrxSVGGraph.php

File

src/FrxPlugin/Renderer/RendererBase.php, line 81
FrxRenderer.php Base class for FrxAPI custom Renderer @author davidmetzler

Class

RendererBase
Crosstab Renderer

Namespace

Drupal\forena\FrxPlugin\Renderer

Code

public function replaceTokens($text, $raw_mode = FALSE) {
  if (is_array($text)) {
    foreach ($text as $k => $v) {
      $text[$k] = $this
        ->replaceTokens($v, $raw_mode);
    }
    return $text;
  }
  elseif (is_object($text)) {
    foreach ($text as $k => $v) {
      $text->{$k} = $this
        ->replaceTokens($v, $raw_mode);
    }
    return $text;
  }
  else {
    return $this->report
      ->replace($text, $raw_mode);
  }
}