You are here

public function ImagickToolkit::submitConfigurationForm in Imagick 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PluginFormInterface::submitConfigurationForm

File

src/Plugin/ImageToolkit/ImagickToolkit.php, line 332

Class

ImagickToolkit
Defines the Imagick toolkit for image manipulation within Drupal.

Namespace

Drupal\imagick\Plugin\ImageToolkit

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->cleanValues();

  /** @var ImageStyle $style */
  foreach (ImageStyle::loadMultiple() as $style) {
    $style
      ->flush();
  }
  $this->configFactory
    ->getEditable(self::CONFIG)
    ->set(self::CONFIG_JPEG_QUALITY, $form_state
    ->getValue([
    'imagick',
    'jpeg',
    self::CONFIG_JPEG_QUALITY,
  ]))
    ->set(self::CONFIG_OPTIMIZE, $form_state
    ->getValue([
    'imagick',
    'jpeg',
    self::CONFIG_OPTIMIZE,
  ]))
    ->set(self::CONFIG_RESIZE_FILTER, $form_state
    ->getValue([
    'imagick',
    self::CONFIG_RESIZE_FILTER,
  ]))
    ->set(self::CONFIG_STRIP_METADATA, $form_state
    ->getValue([
    'imagick',
    self::CONFIG_STRIP_METADATA,
  ]))
    ->save();
}