From e142a4276aa52c044c3a15881b5fd15bfe48d742 Mon Sep 17 00:00:00 2001 From: Petar Gnjidic <32058-petar.gnjidic@users.noreply.drupalcode.org> Date: Sat, 13 May 2023 19:37:27 +0300 Subject: [PATCH] Issue #3002628 by jamiehollern, petar.gnjidic: Allow inline entity form submit handler to return the saved entity --- src/Element/InlineEntityForm.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Element/InlineEntityForm.php b/src/Element/InlineEntityForm.php index 4bce4d40..609a6b91 100644 --- a/src/Element/InlineEntityForm.php +++ b/src/Element/InlineEntityForm.php @@ -177,13 +177,17 @@ class InlineEntityForm extends RenderElement { * The entity form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. + * + * @return Drupal\Core\Entity\EntityInterface\null */ public static function submitEntityForm(array &$entity_form, FormStateInterface $form_state) { $inline_form_handler = static::getInlineFormHandler($entity_form['#entity_type']); $inline_form_handler->entityFormSubmit($entity_form, $form_state); if ($entity_form['#save_entity']) { $inline_form_handler->save($entity_form['#entity']); + return $entity_form['#entity']; } + return NULL; } /** -- GitLab