You are here

public function FrxReport::getField in Forena Reports 7.4

File

./FrxReport.inc, line 383
Basic report provider. Controls the rendering of the report.

Class

FrxReport

Code

public function getField($id) {
  $field = array_fill_keys(array(
    'default',
    'link',
    'add-query',
    'class',
    'rel',
    'format',
    'format-string',
    'target',
    'calc',
    'context',
  ), '');
  if ($this->fields) {
    $path = 'frx:field[@id="' . $id . '"]';
    $formatters = $this->fields
      ->xpath($path);
    if ($formatters) {
      $formatter = $formatters[0];

      //@TODO: Replace the default extraction with something that will get sub elements of the string
      $field['default'] = (string) $formatter;
      $field['link'] = (string) $formatter['link'];
      $field['add-query'] = (string) $formatter['add-query'];
      $field['class'] = (string) $formatter['class'];
      $field['rel'] = (string) $formatter['rel'];
      $field['format'] = (string) $formatter['format'];
      $field['format-string'] = (string) $formatter['format-string'];
      $field['target'] = (string) $formatter['target'];
      $field['calc'] = (string) $formatter['calc'];
    }
  }
  return $field;
}