function EditorHooks::editorFormFilterAdminFormatEditorConfigure
Same name and namespace in other branches
- main core/modules/editor/src/Hook/EditorHooks.php \Drupal\editor\Hook\EditorHooks::editorFormFilterAdminFormatEditorConfigure()
Submit handler for 'editor_configure' button from 'filter_format_form'.
Parameters
array $form: The form render array.
\Drupal\Core\Form\FormStateInterface $form_state: The current form state.
File
-
core/
modules/ editor/ src/ Hook/ EditorHooks.php, line 496
Class
- EditorHooks
- Hook implementations for editor.
Namespace
Drupal\editor\HookCode
public function editorFormFilterAdminFormatEditorConfigure(array $form, FormStateInterface $form_state) : void {
$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,
'image_upload' => [
'status' => FALSE,
],
]);
$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.