You are here

public function ImagemagickToolkit::submitConfigurationForm in ImageMagick 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/ImagemagickToolkit.php \Drupal\imagemagick\Plugin\ImageToolkit\ImagemagickToolkit::submitConfigurationForm()
  2. 8 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 566

Class

ImagemagickToolkit
Provides ImageMagick integration toolkit for image manipulation.

Namespace

Drupal\imagemagick\Plugin\ImageToolkit

Code

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