Same name and namespace in other branches
  1. 8.x-1.x src/Form/ColorboxSettingsForm.php \Drupal\colorbox\Form\ColorboxSettingsForm::submitForm() 1 comment

File

src/Form/ColorboxSettingsForm.php, line 415

Class

ColorboxSettingsForm
General configuration form for controlling the colorbox behaviour..

Namespace

Drupal\colorbox\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $config = $this->configFactory
        ->getEditable('colorbox.settings');
    $config->set('dompurify_hide_warning', $form_state->getValue('dompurify_hide_warning'))
        ->set('custom.style', $form_state->getValue('colorbox_style'))
        ->set('custom.activate', $form_state->getValue('colorbox_custom_settings_activate'))
        ->set('custom.transition_type', $form_state->getValue('colorbox_transition_type'))
        ->set('custom.transition_speed', $form_state->getValue('colorbox_transition_speed'))
        ->set('custom.opacity', $form_state->getValue('colorbox_opacity'))
        ->set('custom.text_current', $form_state->getValue('colorbox_text_current'))
        ->set('custom.text_previous', $form_state->getValue('colorbox_text_previous'))
        ->set('custom.text_next', $form_state->getValue('colorbox_text_next'))
        ->set('custom.text_close', $form_state->getValue('colorbox_text_close'))
        ->set('custom.overlayclose', $form_state->getValue('colorbox_overlayclose'))
        ->set('custom.returnfocus', $form_state->getValue('colorbox_returnfocus'))
        ->set('custom.maxwidth', $form_state->getValue('colorbox_maxwidth'))
        ->set('custom.maxheight', $form_state->getValue('colorbox_maxheight'))
        ->set('custom.initialwidth', $form_state->getValue('colorbox_initialwidth'))
        ->set('custom.initialheight', $form_state->getValue('colorbox_initialheight'))
        ->set('custom.fixed', $form_state->getValue('colorbox_fixed'))
        ->set('custom.scrolling', $form_state->getValue('colorbox_scrolling'))
        ->set('custom.slideshow.slideshow', $form_state->getValue('colorbox_slideshow'))
        ->set('custom.slideshow.auto', $form_state->getValue('colorbox_slideshowauto'))
        ->set('custom.slideshow.speed', $form_state->getValue('colorbox_slideshowspeed'))
        ->set('custom.slideshow.text_start', $form_state->getValue('colorbox_text_start'))
        ->set('custom.slideshow.text_stop', $form_state->getValue('colorbox_text_stop'))
        ->set('advanced.unique_token', $form_state->getValue('colorbox_unique_token'))
        ->set('advanced.mobile_detect', $form_state->getValue('colorbox_mobile_detect'))
        ->set('advanced.mobile_device_width', $form_state->getValue('colorbox_mobile_device_width'))
        ->set('advanced.caption_trim', $form_state->getValue('colorbox_caption_trim'))
        ->set('advanced.caption_trim_length', $form_state->getValue('colorbox_caption_trim_length'))
        ->set('advanced.compression_type', $form_state->getValue('colorbox_compression_type'));
    if ($form_state->getValue('colorbox_image_style')) {
        $config->set('insert.image_style', $form_state->getValue('colorbox_image_style'));
    }
    if ($form_state->getValue('colorbox_insert_gallery')) {
        $config->set('insert.insert_gallery', $form_state->getValue('colorbox_insert_gallery'));
    }
    $config->save();
    parent::submitForm($form, $form_state);
}