function DataManager::dataBlockParams in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/DataManager.php \Drupal\forena\DataManager::dataBlockParams()
File
- src/
DataManager.php, line 382 - DataManager.inc Enter description here ... @author davidmetzler
Class
Namespace
Drupal\forenaCode
function dataBlockParams($data_block, $field, $label) {
/** @var \SimpleXMLElement $xml */
$xml = $this
->data($data_block);
$list = array();
if ($xml) {
$path = $field ? $field : '*[1]';
$label_path = $label ? $label : '*[2]';
//walk through the $xml.
//$rows = $xml->xpath('*');
if ($xml) {
/** @var \SimpleXMLElement $row */
foreach ($xml as $row) {
$value = $row
->xpath($path);
$label_field = $row
->xpath($label_path);
$label_value = $label_field ? (string) $label_field[0] : (string) $value[0];
$list[(string) $value[0]] = (string) $label_value;
}
}
}
return $list;
}