You are here

public function FullcalendarOptions::buildOptionsForm in FullCalendar 8

Same name and namespace in other branches
  1. 8.3 fullcalendar_options/src/Plugin/fullcalendar/type/FullcalendarOptions.php \Drupal\fullcalendar_options\Plugin\fullcalendar\type\FullcalendarOptions::buildOptionsForm()

Overrides FullcalendarInterface::buildOptionsForm

File

fullcalendar_options/src/Plugin/fullcalendar/type/FullcalendarOptions.php, line 44

Class

FullcalendarOptions
@todo.

Namespace

Drupal\fullcalendar_options\Plugin\fullcalendar\type

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $options = $this
    ->optionsListParsed();

  // There were no options added, remove the parent fieldset.
  if (!empty($options)) {
    $form['fullcalendar_options'] = [
      '#type' => 'details',
      '#title' => $this
        ->t('Extra options'),
      '#open' => TRUE,
    ];

    // Add the default value to each option.
    foreach ($options as $key => $info) {
      $form['fullcalendar_options'][$key] = $info;
      if (isset($this->style->options['fullcalendar_options'][$key])) {
        $form['fullcalendar_options'][$key]['#default_value'] = $this->style->options['fullcalendar_options'][$key];
      }
    }
  }
}