You are here

public function FrxCrosstab::configForm in Forena Reports 8

Crosstab configuration form.

File

src/FrxPlugin/Template/FrxCrosstab.php, line 26

Class

FrxCrosstab
Crosstab Report Template

Namespace

Drupal\forena\Template

Code

public function configForm($config) {

  // Load header informationi from parent config.
  $form = parent::configForm($config);
  $this
    ->weight_sort($config['crosstab_columns']);
  $types = array(
    'heading' => t('Heading'),
    'crosstab' => t('Crosstab'),
    'value' => 'Value',
    'ignore' => t('Ignore'),
  );
  $form['crosstab_columns'] = array(
    '#theme' => 'forena_element_draggable',
    '#draggable_id' => 'FrxCrosstab-columns',
  );
  foreach ($config['crosstab_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['type'] = array(
      '#type' => 'radios',
      '#title' => t('Type'),
      '#default_value' => $col['type'],
      '#options' => $types,
      '#ajax' => $this
        ->configAjax(),
    );
    $ctl['weight'] = array(
      "#type" => 'weight',
      '#title' => t('Weight'),
      '#delta' => 50,
      '#default_value' => $col['weight'],
    );
    $form['crosstab_columns'][$key] = $ctl;
  }
  return $form;
}