function ChartsGraphsFlashCanvas::add_dom_element_from_array in Charts and Graphs 6.2
Same name and namespace in other branches
- 7 charts_graphs_flash_canvas.class.inc \ChartsGraphsFlashCanvas::add_dom_element_from_array()
1 call to ChartsGraphsFlashCanvas::add_dom_element_from_array()
File
- ./
charts_graphs_flash_canvas.class.inc, line 81 - abstract class ChartsGraphsFlashCanvas.
Class
- ChartsGraphsFlashCanvas
- Abstract class to be derived for Flash based charting libraries.
Code
function add_dom_element_from_array(&$dom, &$father, $element) {
if (isset($element['#value'])) {
$new_element = $dom
->createElement($element['#id'], (string) $element['#value']);
}
else {
$new_element = $dom
->createElement($element['#id']);
if (isset($element['#cdata'])) {
$cdata = $dom
->createCDATASection((string) $element['#cdata']);
$new_element
->appendChild($cdata);
}
}
if (isset($element['#children'])) {
foreach ($element['#children'] as $child) {
$new_child = $this
->add_dom_element_from_array($dom, $new_element, $child);
$new_element
->appendChild($new_child);
}
}
if (isset($element['#attributes'])) {
foreach ($element['#attributes'] as $attribute_name => $attribute_value) {
$attribute = $dom
->createAttribute((string) $attribute_name);
$new_element
->appendChild($attribute);
$value = $dom
->createTextNode((string) $attribute_value);
$attribute
->appendChild($value);
}
}
$father
->appendChild($new_element);
// var_dump($new_element;
// var_dump($dom->saveXML($new_element));
return $new_element;
}