diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php index ef64fea..73fb556 100644 --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -341,7 +341,11 @@ public function extractFormValues(FieldItemListInterface $items, array $form, Fo // Extract the values from $form_state->getValues(). $path = array_merge($form['#parents'], array($field_name)); $key_exists = NULL; - $values = NestedArray::getValue($form_state->getValues(), $path, $key_exists); + + // Make sure that the massageFormValues() call below always receives an + // array as the first argument because some widgets might not impose this + // structure on its elements (e.g. the 'options_select' widget). + $values = (array) NestedArray::getValue($form_state->getValues(), $path, $key_exists); if ($key_exists) { // Account for drag-and-drop reordering if needed.