Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markconroy/0f73bd13b06c48b53f8dd6d860d07542 to your computer and use it in GitHub Desktop.
Save markconroy/0f73bd13b06c48b53f8dd6d860d07542 to your computer and use it in GitHub Desktop.
diff --git a/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php b/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
index 0859058..7dbd166 100644
--- a/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
+++ b/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
@@ -574,12 +574,14 @@ class InlineEntityFormComplex extends InlineEntityFormBase implements ContainerF
}
}
// Sort values by weight.
- uasort($values, '\Drupal\Component\Utility\SortArray::sortByWeightElement');
- // Let the widget massage the submitted values.
- $values = $this->massageFormValues($values, $form, $form_state);
- // Assign the values and remove the empty ones.
- $items->setValue($values);
- $items->filterEmptyItems();
+ if (!is_null($values)) {
+ uasort($values, '\Drupal\Component\Utility\SortArray::sortByWeightElement');
+ // Let the widget massage the submitted values.
+ $values = $this->massageFormValues($values, $form, $form_state);
+ // Assign the values and remove the empty ones.
+ $items->setValue($values);
+ $items->filterEmptyItems();
+ }
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment