function editor_form_filter_admin_format_editor_configure

editor_form_filter_admin_format_editor_configure($form, FormStateInterface $form_state)

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

File

core/modules/editor/editor.module, line 172
Adds bindings for client-side "text editors" to text formats.

Code

function editor_form_filter_admin_format_editor_configure($form, FormStateInterface $form_state) {
  $editor = $form_state->get('editor');
  $editor_value = $form_state->getValue(array('editor', 'editor'));
  if ($editor_value !== NULL) {
    if ($editor_value === '') {
      $form_state->set('editor', FALSE);
    }
    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();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!editor!editor.module/function/editor_form_filter_admin_format_editor_configure/8.1.x