You are here

public function CkeditorAccordionSettingsForm::buildForm in CKEditor Accordion 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/CkeditorAccordionSettingsForm.php, line 32

Class

CkeditorAccordionSettingsForm
Class CkeditorAccordionSettingsForm.

Namespace

Drupal\ckeditor_accordion\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('ckeditor_accordion.settings');
  $form['collapse_all'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Collapse all tabs by default'),
    '#return_value' => 1,
    '#default_value' => $config
      ->get('collapse_all') ?: 0,
  ];
  $form['keep_rows_open'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Keep accordion rows open when opening another one'),
    '#return_value' => 1,
    '#default_value' => $config
      ->get('keep_rows_open') ?: 0,
  ];
  return parent::buildForm($form, $form_state);
}