You are here

protected function TokenReplacerBase::get_value in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 src/Token/TokenReplacerBase.php \Drupal\forena\Token\TokenReplacerBase::get_value()

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

1 call to TokenReplacerBase::get_value()
TokenReplacerBase::replace in src/Token/TokenReplacerBase.php
Replace the text in a report.
1 method overrides TokenReplacerBase::get_value()
ReportReplacer::get_value in src/Token/ReportReplacer.php
Get the value from the data. This is used by token_replace method to extract the data based on the path provided.

File

src/Token/TokenReplacerBase.php, line 55
FrXSytnaxEngine defines how regular expression procesing/token substitution takes place. It includes support for passing in a formatter oobject that will escape strings properly before substituting them.

Class

TokenReplacerBase
Base class for token replacements. @package Drupal\forena\Token

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 = $dataSvc
    ->getValue($key, $context);
  if ($this->formatter) {
    $value = $this->formatter
      ->format($value, $raw_key, $raw);
  }
  return $value;
}