You are here

public function DataContext::setValue in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 src/Context/DataContext.php \Drupal\forena\Context\DataContext::setValue()

Allows override of a value for the current context.

Parameters

String $key:

String $value:

Overrides Context::setValue

File

src/Context/DataContext.php, line 225
DataContext.php The FrxData class holds all of the data contexts during the report rendering process. The general idea is that during the report render, data objects are pushed on the stack with the id's of the block or foreach objects that…

Class

DataContext

Namespace

Drupal\forena\Context

Code

public function setValue($key, $value, $context = '') {
  if (is_array($this->cur_context)) {
    $this->cur_context[$key] = $value;
    if ($this->cur_context_xml) {
      $this->cur_context_xml->{$key} = $value;
    }
  }
  elseif (is_object($this->cur_context)) {
    if (strpos($key, '@') === 0) {
      $this->cur_context[trim($key, '@')] = $value;
    }
    else {
      $this->cur_context->{$key} = $value;
    }
  }
}