diff --git a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php index 4a6b0bf..52dc85c 100644 --- a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php @@ -1236,7 +1236,17 @@ class InlineParagraphsWidget extends WidgetBase { * {@inheritdoc} */ public function massageFormValues(array $values, array $form, FormStateInterface $form_state) { - $entity = $form_state->getFormObject()->getEntity(); + $form_object = $form_state->getFormObject(); + // establish whether we're in a normal EntityForm context or an inline QuickeditFieldForm context + // and retrieve the entity from the respectively appropriate place + if ($form_object instanceof EntityFormInterface) { + $entity = $form_object->getEntity(); + } else if ($form_object instanceof QuickEditFieldForm) { + $entity = $form_state->getBuildInfo()['args'][0]; + } else { + //TODO handle this case? + } + $field_name = $this->fieldDefinition->getName(); $widget_state = static::getWidgetState($form['#parents'], $field_name, $form_state); $element = NestedArray::getValue($form_state->getCompleteForm(), $widget_state['array_parents']);