You are here

public function FrxFieldTable::scrapeConfig in Forena Reports 7.5

Extract table configuration from the HTML

Overrides RendererBase::scrapeConfig

See also

FrxRenderer::scrapeConfig()

File

src/Renderer/FrxFieldTable.php, line 15
FrxFieldTable Template that displays a table of column/value vertically.

Class

FrxFieldTable

Namespace

Drupal\forena\Renderer

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;
}