You are here

public function DataContext::push in Forena Reports 8

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

Push a data context onto the data stacks to make sure that we can address these using an appropriate syntax. I think we don't need data_stack but i'm holding it there in case we develop a "relative" path syntax.

Parameters

$data:

$id:

File

src/Context/DataContext.php, line 241
Implements \Drupal\forena\Context\DataContext

Class

DataContext
The DataContext 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 invoke them.

Namespace

Drupal\forena\Context

Code

public function push($data, $id = '') {
  $this->data_stack[] = $this->cur_context;
  $this->id_stack[] = $this->id;
  $this->id = $id;
  $this->cur_context = $data;
  $this->cur_context_xml = '';
  if ($id) {

    /*    if (@is_array($this->data_sources[$id]) && is_array($data)) {
          $data = array_merge($this->data_sources[$id], $data);
          }
          */
    $this->data_sources[$id] = $data;
  }
}