diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php index 1075852..3a065d0 100644 --- a/core/modules/editor/src/Form/EditorImageDialog.php +++ b/core/modules/editor/src/Form/EditorImageDialog.php @@ -72,12 +72,14 @@ public function buildForm(array $form, FormStateInterface $form_state, FilterFor // By convention, the data that the text editor sends to any dialog is in // the 'editor_object' key. And the image dialog for text editors expects // that data to be the attributes for an element. - $form_state->set('image_element', $form_state->getUserInput()['editor_object']); + $image_element = $form_state->getUserInput()['editor_object']; + $form_state->set('image_element', $image_element); $form_state->setCached(TRUE); } - - // Retrieve the image element's attributes from form state. - $image_element = $form_state->get('image_element'); + else { + // Retrieve the image element's attributes from form state. + $image_element = $form_state->get('image_element') ?: []; + } $form['#tree'] = TRUE; $form['#attached']['library'][] = 'editor/drupal.editor.dialog';