public function FrxTable::scrapeConfig in Forena Reports 8
Extract table configuration from the HTML
Overrides TemplateInterface::scrapeConfig
See also
FrxRenderer::scrapeConfig()
File
- src/
FrxPlugin/ Template/ FrxTable.php, line 14 - FrxTable Template that lays out a report in a particular table format.
Class
Namespace
Drupal\forena\TemplateCode
public function scrapeConfig(\SimpleXMLElement $xml) {
$config = array();
$caption = $this
->extractXPath('*//caption', $this->reportDocDomNode);
$this
->extractTemplateHTML($this->reportDocDomNode, $config, array(
'table',
));
$tds = $this
->extractXPathInnerHTML('*//td', $this->reportDocDomNode, FALSE);
$ths = $this
->extractXPathInnerHTML('*//th', $this->reportDocDomNode, FALSE);
$columns = array_combine($ths, $tds);
$weight = 0;
foreach ($columns as $label => $token) {
$key = trim($token, '{}');
$weight++;
$config['columns'][$key] = array(
'contents' => $token,
'label' => $label,
'include' => 1,
'weight' => $weight,
);
}
return $config;
}