Commit cf8a0a60 authored by Rob Mumford's avatar Rob Mumford Committed by Merlin Axel Rutz
Browse files

Issue #3261999 by rlmumford, geek-merlin, andrei.vesterli:...

Issue #3261999 by rlmumford, geek-merlin, andrei.vesterli: InlineEntityFormSimple can throw a warning (PHP8) that fails any FunctionalTest with an empty inline entity form
parent 34626ace
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -134,12 +134,13 @@ class InlineEntityFormSimple extends InlineEntityFormBase {
    $submitted_values = $form_state->getValue($parents);
    $values = [];
    foreach ($items as $delta => $value) {
      $element = NestedArray::getValue($form, [$field_name, 'widget', $delta]);
      if ($element = NestedArray::getValue($form, [$field_name, 'widget', $delta])) {
        /** @var \Drupal\Core\Entity\EntityInterface $entity */
        $entity = $element['inline_entity_form']['#entity'];
        $weight = isset($submitted_values[$delta]['_weight']) ? $submitted_values[$delta]['_weight'] : 0;
        $values[$weight] = ['entity' => $entity];
      }
    }

    // Sort items base on weights.
    ksort($values);