You are here

public function BlockEditor::data in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 src/Editor/BlockEditor.php \Drupal\forena\Editor\BlockEditor::data()

Get data and working cache.

Parameters

array $parms:

Return value

\SimpleXMLElement | string

File

src/Editor/BlockEditor.php, line 134

Class

BlockEditor

Namespace

Drupal\forena\Editor

Code

public function data($parms = array(), $raw_mode = FALSE) {

  // Merge in current_context
  $parms = array_merge($this
    ->currentDataContextArray(), $parms);
  $report_parms = $this
    ->getDataContext('parm');
  if ($report_parms) {
    $parms = array_merge($report_parms, $parms);
  }
  $id = str_replace('/', '-', $this->block_name) . '-parm';
  $this
    ->pushData($parms, $id);
  if ($this->edit && $this->provider) {
    $xml = $this
      ->dataManager()
      ->sqlData($this->provider, $this->block['file'], $parms);
  }
  else {
    $xml = $this
      ->dataManager()
      ->data($this->block_name, $raw_mode);
  }
  $driver = get_class($this
    ->dataManager()
    ->repository($this->provider));

  // Allow modules to alter data returned.
  $context = array(
    'block' => $this->block_name,
    'definition' => $this->block,
    'provider' => $this->provider,
    'parameters' => $parms,
    'raw_mode' => $raw_mode,
    'driver' => $driver,
  );
  drupal_alter('forena_data', $xml, $context);
  if ($parms) {
    $this
      ->popData();
  }
  return $xml;
}