function Image::validateConfigurationForm

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image::validateConfigurationForm()
  2. 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image::validateConfigurationForm()

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php, line 64

Class

Image
CKEditor 5 Image plugin.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    $form_state->setValue('status', (bool) $form_state->getValue('status'));
    $directory = $form_state->getValue([
        'directory',
    ]);
    $form_state->setValue([
        'directory',
    ], trim($directory) === '' ? NULL : $directory);
    $max_size = $form_state->getValue([
        'max_size',
    ]);
    $form_state->setValue([
        'max_size',
    ], trim($max_size) === '' ? NULL : $max_size);
    $max_width = $form_state->getValue([
        'max_dimensions',
        'width',
    ]);
    $form_state->setValue([
        'max_dimensions',
        'width',
    ], trim($max_width) === '' ? NULL : (int) $max_width);
    $max_height = $form_state->getValue([
        'max_dimensions',
        'height',
    ]);
    $form_state->setValue([
        'max_dimensions',
        'height',
    ], trim($max_height) === '' ? NULL : (int) $max_height);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.