You are here

public function FrxTable::scrapeConfig in Forena Reports 7.5

Extract table configuration from the HTML

Overrides RendererBase::scrapeConfig

See also

FrxRenderer::scrapeConfig()

File

src/Renderer/FrxTable.php, line 14
FrxTable Template that lays out a report in a particular table format.

Class

FrxTable

Namespace

Drupal\forena\Renderer

Code

public function scrapeConfig() {
  $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;
}