You are here

public function CKEditor::submitConfigurationForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::submitConfigurationForm()
  2. 10 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::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 EditorBase::submitConfigurationForm

File

core/modules/ckeditor/src/Plugin/Editor/CKEditor.php, line 260

Class

CKEditor
Defines a CKEditor-based text editor for Drupal.

Namespace

Drupal\ckeditor\Plugin\Editor

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

  // The rows key is not built into the form structure, so decode the button
  // groups data into this new key and remove the button_groups key.
  $form_state
    ->setValue([
    'toolbar',
    'rows',
  ], json_decode($form_state
    ->getValue([
    'toolbar',
    'button_groups',
  ]), TRUE));
  $form_state
    ->unsetValue([
    'toolbar',
    'button_groups',
  ]);

  // Remove the plugin settings' vertical tabs state; no need to save that.
  if ($form_state
    ->hasValue('plugins')) {
    $form_state
      ->unsetValue('plugin_settings');
  }
}