Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Methods that work on a specific $delta in a list of $items (FieldItemList) should receive that $item (FieldItem) directly instead of $items + $delta
Comment | File | Size | Author |
---|---|---|---|
#1 | 2175343-1.patch | 36.61 KB | swentel |
Comments
Comment #1
swentel CreditAttribution: swentel commentedComment #3
yched CreditAttribution: yched commented[edited out: that was meant for the OP]
Comment #4
yched CreditAttribution: yched commentedComment #5
andypostHow this change will affect a widgets that manage multiple values internally, for example autocomplete?
Comment #6
yched CreditAttribution: yched commentedHm - yeah.
In the end, "widgets than manage multiple items" and "widgets that manage one single item and need to be repeated" would be better off using separate methods, instead of both going through the half-assed Widget::formElements($items, $delta).
That was the goal of #1846162: Cleanup Widgets API : add a separate base class for 'multiple' widgets, but it never went through.
Comment #7
plopescPostponing on #1846162: Cleanup Widgets API : add a separate base class for 'multiple' widgets