You are here

public function CropWidgetForm::submitForm in Image Widget Crop 8

Same name and namespace in other branches
  1. 8.2 src/Form/CropWidgetForm.php \Drupal\image_widget_crop\Form\CropWidgetForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

src/Form/CropWidgetForm.php, line 208

Class

CropWidgetForm
Configure ImageWidgetCrop general settings for this site.

Namespace

Drupal\image_widget_crop\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);

  // We need to rebuild the library cache if we switch from remote to local
  // library or vice-versa.
  Cache::invalidateTags([
    'library_info',
  ]);
  $this->settings
    ->set("settings.library_url", $form_state
    ->getValue('library_url'))
    ->set("settings.css_url", $form_state
    ->getValue('css_url'))
    ->set("settings.crop_preview_image_style", $form_state
    ->getValue('crop_preview_image_style'))
    ->set("settings.show_default_crop", $form_state
    ->getValue('show_default_crop'))
    ->set("settings.show_crop_area", $form_state
    ->getValue('show_crop_area'))
    ->set("settings.warn_multiple_usages", $form_state
    ->getValue('warn_multiple_usages'))
    ->set("settings.crop_list", $form_state
    ->getValue('crop_list'));
  $this->settings
    ->save();
}