You are here

protected function FullcalendarOptions::optionsListParsed 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::optionsListParsed()

@todo.

2 calls to FullcalendarOptions::optionsListParsed()
FullcalendarOptions::buildOptionsForm in fullcalendar_options/src/Plugin/fullcalendar/type/FullcalendarOptions.php
FullcalendarOptions::defineOptions in fullcalendar_options/src/Plugin/fullcalendar/type/FullcalendarOptions.php

File

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

Class

FullcalendarOptions
@todo.

Namespace

Drupal\fullcalendar_options\Plugin\fullcalendar\type

Code

protected function optionsListParsed() {
  $form = $this
    ->optionsList();
  $settings = \Drupal::config('fullcalendar_options.settings')
    ->get();

  // By default, restrict the form to options allowed by the admin settings.
  $form = array_intersect_key($form, array_filter($settings));
  if (isset($form['dayClick'])) {

    // Add in dependency form elements.
    $form['dayClickView'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Display'),
      '#description' => $this
        ->t('The display to switch to when a day is clicked.'),
      '#default_value' => 'agendaWeek',
      '#options' => [
        'month' => $this
          ->t('Month'),
        'agendaWeek' => $this
          ->t('Week (Agenda)'),
        'basicWeek' => $this
          ->t('Week (Basic)'),
        'agendaDay' => $this
          ->t('Day (Agenda)'),
        'basicDay' => $this
          ->t('Day (Basic)'),
      ],
      '#states' => [
        'visible' => [
          ':input[name="style_options[fullcalendar_options][dayClick]"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
  }
  return $form;
}