You are here

public function GeneralConfigForm::buildForm in Forena Reports 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/GeneralConfigForm.php, line 30
Implements \Drupal\forena\GeneralConfigForm

Class

GeneralConfigForm
Provides General Configuration form

Namespace

Drupal\forena\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $skins = ReportManager::instance()
    ->skins();
  $config = $this
    ->config('forena.settings');

  /*@TODO: Fix Input format selection */

  //$form['forena_input_format'] = forena_filter_element($config->get('forena_input_format'));
  $form['default_skin'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Default Skin'),
    '#options' => $skins,
    '#description' => t('Specify the default skin to be used.   New skins can be created by creating .skin.yml files in your reports directory.' . ' Skins are basically css and javascript libraries added to your report.'),
    '#default_value' => $config
      ->get('default_skin'),
  ];
  $formats = filter_formats();
  $options = [
    'none' => $this
      ->t('None'),
  ];
  foreach ($formats as $format) {
    $options[$format
      ->id()] = $format
      ->label();
  }
  $form['input_format'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Text Format'),
    '#description' => $this
      ->t('Process reports using Text Formats. This can be overridden at the skin or report level.'),
    '#options' => $options,
    '#default_value' => $config
      ->get('input_format'),
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  return parent::buildForm($form, $form_state);
}