You are here

public function FrxCrosstab::configForm in Forena Reports 7.5

Crosstab configuration form.

Overrides RendererBase::configForm

File

src/Renderer/FrxCrosstab.php, line 177

Class

FrxCrosstab

Namespace

Drupal\forena\Renderer

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