You are here

public function FrxFieldTable::configForm in Forena Reports 8

Template configuration form @parmater $configuration form

File

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

Class

FrxFieldTable
Field Table Template

Namespace

Drupal\forena\Template

Code

public function configForm($config) {

  // Load header informationi from parent config.
  $form = parent::configForm($config);
  $this
    ->weight_sort($config['columns']);
  $form['columns'] = array(
    '#theme' => 'forena_element_draggable',
    '#draggable_id' => 'FrxTable-columns',
  );
  foreach ($config['columns'] as $key => $col) {
    $ctl = array();
    $ctl['label'] = array(
      '#type' => 'textfield',
      '#size' => 30,
      '#title' => t('Label'),
      '#default_value' => $col['label'],
    );
    $ctl['contents'] = array(
      '#type' => 'textfield',
      '#size' => '30',
      '#title' => t('Data'),
      '#default_value' => $col['contents'],
    );
    $ctl['include'] = array(
      '#type' => 'checkbox',
      '#title' => t('Include'),
      '#default_value' => $col['include'],
      '#ajax' => $this
        ->configAjax(),
    );
    $ctl['weight'] = array(
      "#type" => 'weight',
      '#title' => t('Weight'),
      '#delta' => 50,
      '#default_value' => $col['weight'],
    );
    $form['columns'][$key] = $ctl;
  }
  return $form;
}