Commit d58d8d1d authored by Alae Akalay's avatar Alae Akalay Committed by Andrei Mateescu
Browse files

Issue #3306880 by alaeak.technalia: Autocomplete dragtable allows empty values...

Issue #3306880 by alaeak.technalia: Autocomplete dragtable allows empty values and inserts empty entry
parent 8177d754
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -335,6 +335,12 @@ class EntityqueueDragtableWidget extends EntityReferenceAutocompleteWidget {
    // Go two levels up in the form, to the widgets container.
    $element = NestedArray::getValue($form, array_slice($button['#array_parents'], 0, -2));

    // No value inserted on the input or empty value, we don't replace the
    // 'items-wrapper' element, this will prevent adding empty values.
    if ($element['add_more']['new_item']['target_id']['#value'] === '') {
      return $element;
    }

    // Remove the submitted value from the 'Add item' textfield.
    $element['add_more']['new_item']['target_id']['#value'] = NULL;