You are here

public function DataContext::currentContextArray in Forena Reports 7.5

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

Return current context as key value pairs Enter description here

File

src/Context/DataContext.php, line 68
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 currentContextArray() {
  $data = $this->cur_context;
  if (is_array($data)) {
    return $data;
  }
  $ret = array();
  if (is_object($data)) {

    // Get attributes
    $ret = get_object_vars($data);
    if (method_exists($data, 'attributes')) {
      foreach ($data
        ->attributes() as $key => $value) {
        $ret[$key] = (string) $value;
      }
    }
  }
  else {
    $ret = (array) $data;
  }
  return $ret;
}