You are here

public function DrupalImage::validateImageUploadSettings in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/GutenbergPlugin/DrupalImage.php \Drupal\gutenberg\Plugin\GutenbergPlugin\DrupalImage::validateImageUploadSettings()

Handler #element_validate for the "image_upload" element in settingsForm().

Moves the text editor's image upload settings from the DrupalImage plugin's own settings into $editor->image_upload.

See also

\Drupal\editor\Form\EditorImageDialog

editor_image_upload_settings_form()

File

src/Plugin/GutenbergPlugin/DrupalImage.php, line 69

Class

DrupalImage
Defines the "drupalimage" plugin.

Namespace

Drupal\gutenberg\Plugin\GutenbergPlugin

Code

public function validateImageUploadSettings(array $element, FormStateInterface $form_state) {
  $settings =& $form_state
    ->getValue([
    'editor',
    'settings',
    'plugins',
    'drupalimage',
    'image_upload',
  ]);
  $form_state
    ->get('editor')
    ->setImageUploadSettings($settings);
  $form_state
    ->unsetValue([
    'editor',
    'settings',
    'plugins',
    'drupalimage',
  ]);
}