You are here

public function SettingsForm::buildForm in FullCalendar 8

Same name in this branch
  1. 8 src/Form/SettingsForm.php \Drupal\fullcalendar\Form\SettingsForm::buildForm()
  2. 8 fullcalendar_options/src/Form/SettingsForm.php \Drupal\fullcalendar_options\Form\SettingsForm::buildForm()
Same name and namespace in other branches
  1. 8.3 fullcalendar_options/src/Form/SettingsForm.php \Drupal\fullcalendar_options\Form\SettingsForm::buildForm()

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

fullcalendar_options/src/Form/SettingsForm.php, line 63

Class

SettingsForm
TODO

Namespace

Drupal\fullcalendar_options\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('fullcalendar_options.settings');
  $form['fullcalendar_options'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Options'),
    '#description' => $this
      ->t('Each setting can be exposed for all views.'),
    '#open' => TRUE,
  ];
  foreach ($this->options as $key => $info) {
    $form['fullcalendar_options'][$key] = [
      '#type' => 'checkbox',
      '#default_value' => $config
        ->get($key),
    ] + $info;
  }
  return parent::buildForm($form, $form_state);
}