You are here

protected function ReportReplacer::get_value in Forena Reports 8

Get the value from the data. This is used by token_replace method to extract the data based on the path provided.

Parameters

$data:

$key:

Return value

string|array

Overrides TokenReplacerBase::get_value

File

src/Token/ReportReplacer.php, line 76

Class

ReportReplacer

Namespace

Drupal\forena\Token

Code

protected function get_value($key, $raw = FALSE) {
  $context = '';
  $raw_key = $key;
  $dataSvc = $this
    ->dataService();
  if ($key && strpos($key, '.')) {
    @(list($context, $key) = explode('.', $key, 2));
    $o = $this
      ->getDataContext($context);
  }
  else {
    $o = $this
      ->currentDataContext();
  }
  $value = htmlentities($dataSvc
    ->getValue($key, $context));
  if ($this->formatter) {
    $value = $this->formatter
      ->format($value, $raw_key, $raw);
  }
  return $value;
}