function DataManager::data in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/DataManager.php \Drupal\forena\DataManager::data()
Extract the data by running a block
Parameters
$data_block String name ob block to load:
Return value
\SimpleXMLElement
2 calls to DataManager::data()
- DataManager::blockAccess in src/
DataManager.php - Check access control using the block in a data block. In this case public assess returns true.
- DataManager::dataBlockParams in src/
DataManager.php
File
- src/
DataManager.php, line 210 - DataManager.inc Enter description here ... @author davidmetzler
Class
Namespace
Drupal\forenaCode
function data($data_block, $raw_mode = FALSE, array $data = []) {
list($provider) = explode('/', $data_block, 2);
//Intstantiate the provider
$o = $this
->repository($provider);
$repos = @$this->repositories[$provider];
if (isset($repos['enabled']) && !$repos['enabled']) {
return '';
}
//Populate user callback.
if (isset($repos['user callback'])) {
$user_fn = $repos['user callback'];
if (is_callable($user_fn)) {
$current_user = $user_fn();
$this->dataSvc
->setValue('current_user', $current_user);
}
}
if ($data) {
foreach ($data as $key => $value) {
$this->dataSvc
->setValue($key, $value);
}
}
$xml = NULL;
if ($o) {
$block = $this
->loadBlock($data_block);
$xml = $o
->data($block, $raw_mode);
}
return $xml;
}