function editor_form_filter_admin_format_editor_configure

Same name and namespace in other branches
  1. 9 core/modules/editor/editor.module \editor_form_filter_admin_format_editor_configure()
  2. 8.9.x core/modules/editor/editor.module \editor_form_filter_admin_format_editor_configure()
  3. 11.x core/modules/editor/editor.module \editor_form_filter_admin_format_editor_configure()

Button submit handler for filter_format_form()'s 'editor_configure' button.

2 string references to 'editor_form_filter_admin_format_editor_configure'
CKEditor5::validateConfigurationForm in core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php
Form validation handler.
editor_form_filter_format_form_alter in core/modules/editor/editor.module
Implements hook_form_BASE_FORM_ID_alter() for \Drupal\filter\FilterFormatEditForm.

File

core/modules/editor/editor.module, line 172

Code

function editor_form_filter_admin_format_editor_configure($form, FormStateInterface $form_state) {
  $editor = $form_state->get('editor');
  $editor_value = $form_state->getValue([
    'editor',
    'editor',
  ]);
  if ($editor_value !== NULL) {
    if ($editor_value === '') {
      $form_state->set('editor', FALSE);
      $form_state->set('editor_plugin', NULL);
    }
    elseif (empty($editor) || $editor_value !== $editor->getEditor()) {
      $format = $form_state->getFormObject()
        ->getEntity();
      $editor = Editor::create([
        'format' => $format->isNew() ? NULL : $format->id(),
        'editor' => $editor_value,
      ]);
      $form_state->set('editor', $editor);
    }
  }
  $form_state->setRebuild();
}

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