You are here

public function ImagemagickToolkit::submitConfigurationForm in ImageMagick 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/ImagemagickToolkit.php \Drupal\imagemagick\Plugin\ImageToolkit\ImagemagickToolkit::submitConfigurationForm()
  2. 8.2 src/Plugin/ImageToolkit/ImagemagickToolkit.php \Drupal\imagemagick\Plugin\ImageToolkit\ImagemagickToolkit::submitConfigurationForm()

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/ImagemagickToolkit.php, line 521

Class

ImagemagickToolkit
Provides ImageMagick integration toolkit for image manipulation.

Namespace

Drupal\imagemagick\Plugin\ImageToolkit

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $this->configFactory
    ->getEditable('imagemagick.settings')
    ->set('quality', $form_state
    ->getValue([
    'imagemagick',
    'quality',
  ]))
    ->set('binaries', $form_state
    ->getValue([
    'imagemagick',
    'suite',
    'binaries',
  ]))
    ->set('path_to_binaries', $form_state
    ->getValue([
    'imagemagick',
    'suite',
    'path_to_binaries',
  ]))
    ->set('use_identify', $form_state
    ->getValue([
    'imagemagick',
    'formats',
    'use_identify',
  ]))
    ->set('image_formats', Yaml::decode($form_state
    ->getValue([
    'imagemagick',
    'formats',
    'mapping',
    'image_formats',
  ])))
    ->set('prepend', $form_state
    ->getValue([
    'imagemagick',
    'exec',
    'prepend',
  ]))
    ->set('locale', $form_state
    ->getValue([
    'imagemagick',
    'exec',
    'locale',
  ]))
    ->set('log_warnings', (bool) $form_state
    ->getValue([
    'imagemagick',
    'exec',
    'log_warnings',
  ]))
    ->set('debug', $form_state
    ->getValue([
    'imagemagick',
    'exec',
    'debug',
  ]))
    ->set('advanced.density', $form_state
    ->getValue([
    'imagemagick',
    'advanced',
    'density',
  ]))
    ->set('advanced.colorspace', $form_state
    ->getValue([
    'imagemagick',
    'advanced',
    'colorspace',
  ]))
    ->set('advanced.profile', $form_state
    ->getValue([
    'imagemagick',
    'advanced',
    'profile',
  ]))
    ->save();
}