You are here

public function FrxFieldTable::scrapeConfig in Forena Reports 7.4

Extract table configuration from the HTML

Overrides FrxRenderer::scrapeConfig

See also

FrxRenderer::scrapeConfig()

File

renderers/FrxFieldTable.inc, line 14
FrxFieldTable Template that displays a table of column/value vertically.

Class

FrxFieldTable
@file FrxFieldTable Template that displays a table of column/value vertically.

Code

public function scrapeConfig() {
  $config = array();
  $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);
  $i = 0;
  foreach ($columns as $label => $token) {
    $i++;
    $key = trim($token, '{}');
    $config['columns'][$key] = array(
      'contents' => $token,
      'label' => $label,
      'include' => 1,
      'weight' => $i,
    );
  }
  return $config;
}