function RendererBase::addFragment in Forena Reports 7.5
Append a textual XHTML fragment to the dom. We do not use the DOMDocumentFragment optioin because they don't properly import namespaces. .
Parameters
DOMNode $node:
unknown $xml_string:
string $ctl_name:
7 calls to RendererBase::addFragment()
- FrxCrosstab::generate in src/
Renderer/ FrxCrosstab.php - Generate the template from the configuration.
- FrxEmailMerge::generate in src/
Renderer/ FrxEmailMerge.php - Generate the template from the configuration.
- FrxFieldTable::generate in src/
Renderer/ FrxFieldTable.php - Generate the template from the configuration.
- FrxMergeDocument::generate in src/
Renderer/ FrxMergeDocument.php - Generate the template from the configuration.
- FrxSection::generate in src/
Renderer/ FrxSection.php - Build the template
File
- src/
Renderer/ RendererBase.php, line 644 - FrxRenderer.php Base class for Frx custom Renderer @author davidmetzler
Class
Namespace
Drupal\forena\RendererCode
function addFragment(DOMNode $node, $xml_string, $ctl_name = 'Header') {
if (is_array($xml_string) && isset($xml_string['value'])) {
$xml_string = $xml_string['value'];
}
if ($xml_string && !is_array($xml_string)) {
$temp_dom = Frx::tempDOM();
$body_xml = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY nbsp " ">
]><html xmlns:frx="' . $this->xmlns . '"><body>' . $xml_string . '</body></html>';
try {
$temp_dom
->loadXML($body_xml);
} catch (Exception $e) {
Frx::error('Malformed report body', '<pre>' . $e
->getMessage() . $e
->getTraceAsString() . '</pre>');
}
$body = $temp_dom
->getElementsByTagName('body')
->item(0);
foreach ($body->childNodes as $sub) {
$new_node = $this->frxReport->dom
->importNode($sub, TRUE);
$node
->appendChild($new_node);
}
if ($node->nodeType == XML_ELEMENT_NODE) {
$xmlnode = simplexml_import_dom($node);
$frx_nodes = $xmlnode
->xpath('//*[@frx:*]');
if (!$frx_nodes) {
$this
->frxReportsave_attributes_by_id();
}
}
}
}