You are here

public function FullCalendarDisplay::submitOptionsForm in Fullcalendar View 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/style/FullCalendarDisplay.php \Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay::submitOptionsForm()
  2. 8.2 src/Plugin/views/style/FullCalendarDisplay.php \Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay::submitOptionsForm()
  3. 6.x src/Plugin/views/style/FullCalendarDisplay.php \Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay::submitOptionsForm()
  4. 5.x src/Plugin/views/style/FullCalendarDisplay.php \Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay::submitOptionsForm()

Options form submit handle function.

Overrides PluginBase::submitOptionsForm

See also

\Drupal\views\Plugin\views\PluginBase::submitOptionsForm()

File

src/Plugin/views/style/FullCalendarDisplay.php, line 280

Class

FullCalendarDisplay
Style plugin to render content for FullCalendar.

Namespace

Drupal\fullcalendar_view\Plugin\views\style

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
  $options =& $form_state
    ->getValue('style_options');
  $input_value = $form_state
    ->getUserInput();
  $input_colors = isset($input_value['style_options']['color_taxonomies']) ? $input_value['style_options']['color_taxonomies'] : [];

  // Save the input of colors.
  foreach ($input_colors as $id => $color) {
    if (!empty($color)) {
      $options['color_taxonomies'][$id] = $color;
    }
  }

  // Datetime fields in Drupal 8 are stored as strings.
  if (isset($options['business_start'])) {
    $options['business_start'] = $options['business_start']
      ->format(DATETIME_DATETIME_STORAGE_FORMAT);
  }
  if (isset($options['business_end'])) {
    $options['business_end'] = $options['business_end']
      ->format(DATETIME_DATETIME_STORAGE_FORMAT);
  }
  parent::submitOptionsForm($form, $form_state);
}